Merge pull request #2 from Dpeta/master
Commited to wrong branch accidentally, whoops.
This commit is contained in:
commit
3f2e5f23a6
4 changed files with 50 additions and 32 deletions
11
README.md
11
README.md
|
@ -1,8 +1,15 @@
|
|||
# Pesterchum Alternate Servers
|
||||
Normal pesterchum documentation is in "README-pesterchum.mkdn", and the one for Karxi's fork is README-karxi.mkdn.
|
||||
A mirror of pesterchum with added functionality to connect to alternative servers in response to the offical servers shutting down on 01-01-2021. (And with an edited setup.py file)
|
||||
|
||||
Normal pesterchum documentation is in "README-pesterchum.mkdn" and the one for Karxi's fork is README-karxi.mkdn.
|
||||
|
||||
## Servers
|
||||
Currently promts the user on launch to choose a server. The implementation of this very much done incorrectly, but it seems to function in it's current state.
|
||||
Currently promts the user on launch to choose a server. The implementation of this isn't very pretty, but it seems to function in it's current state.
|
||||
|
||||
Currently lets you choose between:
|
||||
* ghostDunk's server
|
||||
* My server
|
||||
* @chaoticCharacte's server
|
||||
|
||||
## Building
|
||||
Just simply running "python setup.py build" seems to be working for me for building on windows now.
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# pesterchum
|
||||
import os, shutil, sys, getopt
|
||||
import configparser
|
||||
if os.path.dirname(sys.argv[0]):
|
||||
os.chdir(os.path.dirname(sys.argv[0]))
|
||||
import logging
|
||||
|
@ -136,7 +137,6 @@ BOTNAMES.extend(CUSTOMBOTS)
|
|||
_CONSOLE_ENV = AttrDict()
|
||||
_CONSOLE_ENV.PAPP = None
|
||||
|
||||
|
||||
class waitingMessageHolder(object):
|
||||
def __init__(self, mainwindow, **msgfuncs):
|
||||
self.mainwindow = mainwindow
|
||||
|
@ -3043,6 +3043,38 @@ class MainProgram(QtCore.QObject):
|
|||
|
||||
options = self.oppts(sys.argv[1:])
|
||||
|
||||
# Choose a server by qt message box.
|
||||
# Writes the result to server.ini
|
||||
|
||||
msgBox = QtGui.QMessageBox()
|
||||
msgBox.setIcon(QtGui.QMessageBox.Information)
|
||||
msgBox.setWindowTitle("Choose a server.")
|
||||
msgBox.setText("Which server do you want to connect to?")
|
||||
msgBox.addButton(QtGui.QPushButton("ghostDunk's server (Official)"), QtGui.QMessageBox.YesRole)
|
||||
msgBox.addButton(QtGui.QPushButton("turntechCatnip's server"), QtGui.QMessageBox.NoRole)
|
||||
msgBox.addButton(QtGui.QPushButton('kaliope.ddns.net'), QtGui.QMessageBox.RejectRole)
|
||||
ret = msgBox.exec_()
|
||||
reply = msgBox.buttonRole(msgBox.clickedButton())
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config.read('server.ini')
|
||||
|
||||
if (reply==QtGui.QMessageBox.YesRole):
|
||||
print("Server is: irc.mindfang.org")
|
||||
config['SERVER']['server'] = 'irc.mindfang.org'
|
||||
if (reply==QtGui.QMessageBox.NoRole):
|
||||
print("Server is: 178.84.124.125")
|
||||
config['SERVER']['server'] = '178.84.124.125'
|
||||
if (reply==QtGui.QMessageBox.RejectRole):
|
||||
print("Server is: kaliope.ddns.net")
|
||||
config['SERVER']['server'] = 'kaliope.ddns.net'
|
||||
|
||||
#Write result to server.ini
|
||||
with open('server.ini', 'w') as configfile:
|
||||
config.write(configfile)
|
||||
|
||||
|
||||
|
||||
def doSoundInit():
|
||||
# TODO: Make this more uniform, adapt it into a general function.
|
||||
if pygame and pygame.mixer:
|
||||
|
|
35
profile.py
35
profile.py
|
@ -14,6 +14,8 @@ from mood import Mood
|
|||
from dataobjs import PesterProfile, pesterQuirk, pesterQuirks
|
||||
from parsetools import convertTags, addTimeInitial, themeChecker, ThemeException
|
||||
|
||||
import configparser # For loading server.ini
|
||||
|
||||
_datadir = ostools.getDataDir()
|
||||
|
||||
class PesterLog(object):
|
||||
|
@ -285,35 +287,10 @@ class userConfig(object):
|
|||
def server(self):
|
||||
if hasattr(self.parent, 'serverOverride'):
|
||||
return self.parent.serverOverride
|
||||
# Okay, so I tried to use qt to promt the user to choose a server via a message box.
|
||||
# It seems to ...work... but I know that this isn't the proper way to implement something like this at all.
|
||||
# But, uh, I have no clue how to properly use qt.
|
||||
# If anyone knows how to actually implement something like this please feel free to fix this.
|
||||
# HOPEFULLY this is a temporary solution
|
||||
|
||||
msgBox = QtGui.QMessageBox()
|
||||
msgBox.setIcon(QtGui.QMessageBox.Information)
|
||||
msgBox.setWindowTitle("Choose a server.")
|
||||
msgBox.setText("Which server do you want to connect to?")
|
||||
msgBox.addButton(QtGui.QPushButton("ghostDunk's server (Official)"), QtGui.QMessageBox.YesRole)
|
||||
msgBox.addButton(QtGui.QPushButton("turntechCatnip's server"), QtGui.QMessageBox.NoRole)
|
||||
msgBox.addButton(QtGui.QPushButton('kaliope.ddns.net'), QtGui.QMessageBox.RejectRole)
|
||||
ret = msgBox.exec_()
|
||||
#pressed_button = msgBox.clickedButton()
|
||||
reply = msgBox.buttonRole(msgBox.clickedButton())
|
||||
|
||||
if (reply==QtGui.QMessageBox.YesRole):
|
||||
print("Server is: irc.mindfang.org")
|
||||
return self.config.get('server', 'irc.mindfang.org')
|
||||
if (reply==QtGui.QMessageBox.NoRole):
|
||||
print("Server is: 178.84.124.125")
|
||||
return self.config.get('server', '178.84.124.125')
|
||||
if (reply==QtGui.QMessageBox.RejectRole):
|
||||
print("Server is: kaliope.ddns.net")
|
||||
return self.config.get('server', 'kaliope.ddns.net')
|
||||
|
||||
#print(reply)
|
||||
#return self.config.get('server', 'irc.mindfang.org')
|
||||
# Get chosen server from server.ini
|
||||
config = configparser.ConfigParser()
|
||||
config.read('server.ini')
|
||||
return self.config.get('server', config['SERVER']['server'])
|
||||
def port(self):
|
||||
if hasattr(self.parent, 'portOverride'):
|
||||
return self.parent.portOverride
|
||||
|
|
2
server.ini
Normal file
2
server.ini
Normal file
|
@ -0,0 +1,2 @@
|
|||
[SERVER]
|
||||
server = 178.84.124.125
|
Loading…
Reference in a new issue