Port is now properly saved in config file

This commit is contained in:
Uriziel 2012-12-12 19:46:54 +01:00
parent 2772762dcc
commit 6cb134a3b8
2 changed files with 11 additions and 3 deletions

View File

@ -72,7 +72,7 @@ class ConfigurationGetter(object):
with open(self._configFile, 'wb') as configfile:
if(not self._config.has_section(section_name)):
self._config.add_section(section_name)
self._config.set(section_name, 'host', self._args.host)
self._config.set(section_name, 'host', self._args.host+":"+str(self._args.port))
self._config.set(section_name, 'name', self._args.name)
self._config.set(section_name, 'room', self._args.room)
self._config.set(section_name, 'password', self._args.password)
@ -152,7 +152,7 @@ class ConfigurationGetter(object):
if ':' in self._args.host:
self._args.host, port = self._args.host.split(':', 1)
self._args.port = int(port)
else:
elif("port" not in self._args):
self._args.port = 8999
def setConfiguration(self, args):

View File

@ -34,7 +34,15 @@ class GuiConfiguration:
self.closedAndNotSaved = True
def _addLabeledEntries(self, args, vbox):
self.hostEntry = self._addLabeledEntryToVbox('Host: ', args.host, vbox, self._focusNext)
if(args.host == None):
host = ""
elif(":" in args.host):
host = args.host
elif("port" in args):
host = args.host+":"+str(args.port)
else:
host = args.host
self.hostEntry = self._addLabeledEntryToVbox('Host: ', host, vbox, self._focusNext)
self.userEntry = self._addLabeledEntryToVbox('Username: ', args.name, vbox, self._focusNext)
self.roomEntry = self._addLabeledEntryToVbox('Default room (optional): ', args.room, vbox, self._focusNext)
self.passEntry = self._addLabeledEntryToVbox('Server password (optional): ', args.password, vbox, self._focusNext)