def loadconfig(self): """Load config from disk.""" cr = ConfigParser.ConfigParser({ 'host': USCBSRV_HOST, 'port': str(USCBSRV_PORT), 'channel': USCBSRV_CHANNEL, 'srvnick': USCBSRV_SRVNICK, 'cltnick': USCBSRV_CLTNICK, 'fontsize': str(FONTSIZE), 'fullscreen': 'Yes', 'motd': MOTD }) cr.add_section('uscbsrv') cr.add_section('announce') # check for config file try: a = len(cr.read(CONFIGFILE)) if a == 0: print('No config file found - loading default values.') except Exception as e: print('Error reading config: ' + str(e)) self.motd = cr.get('announce', 'motd') if strops.confopt_bool(cr.get('announce', 'fullscreen')): self.window.fullscreen() nhost = cr.get('uscbsrv', 'host') nport = strops.confopt_posint(cr.get('uscbsrv', 'port'), USCBSRV_PORT) nchannel = cr.get('uscbsrv', 'channel') ncltnick = cr.get('uscbsrv', 'cltnick') nsrvnick = cr.get('uscbsrv', 'srvnick') self.io.set_port(nhost, nport, nchannel, ncltnick, nsrvnick)
def loadconfig(self): """Load config from disk.""" cr = ConfigParser.ConfigParser( { "host": USCBSRV_HOST, "port": str(USCBSRV_PORT), "channel": USCBSRV_CHANNEL, "srvnick": USCBSRV_SRVNICK, "cltnick": USCBSRV_CLTNICK, "timetick": str(TIMETICK), "fontsize": str(FONTSIZE), "fullscreen": "Yes", "motd": MOTD, } ) cr.add_section("uscbsrv") cr.add_section("announce") # check for config file try: a = len(cr.read(CONFIGFILE)) if a == 0: print("No config file found - loading default values.") except e: print("Error reading config: " + str(e)) self.timetick = strops.confopt_posint(cr.get("announce", "timetick"), TIMETICK) self.fontsize = strops.confopt_posint(cr.get("announce", "fontsize"), FONTSIZE) self.motd = cr.get("announce", "motd") if strops.confopt_bool(cr.get("announce", "fullscreen")): self.window.fullscreen() nhost = cr.get("uscbsrv", "host") nport = strops.confopt_posint(cr.get("uscbsrv", "port"), USCBSRV_PORT) nchannel = cr.get("uscbsrv", "channel") ncltnick = cr.get("uscbsrv", "cltnick") nsrvnick = cr.get("uscbsrv", "srvnick") self.io.set_port(nhost, nport, nchannel, ncltnick, nsrvnick) fnszstr = str(self.fontsize) + "px" self.lbl_header.modify_font(pango.FontDescription("bold " + fnszstr)) self.elap_lbl.modify_font(pango.FontDescription("monospace bold " + fnszstr)) self.search_lbl.modify_font(pango.FontDescription(fnszstr)) self.search_entry.modify_font(pango.FontDescription(fnszstr)) self.view.modify_font(pango.FontDescription("bold " + fnszstr))
def loadconfig(self): """Load config from disk.""" cr = ConfigParser.ConfigParser({'host':USCBSRV_HOST, 'port':str(USCBSRV_PORT), 'channel':USCBSRV_CHANNEL, 'srvnick':USCBSRV_SRVNICK, 'cltnick':USCBSRV_CLTNICK, 'timetick':str(TIMETICK), 'fontsize':str(FONTSIZE), 'fullscreen':'Yes', 'motd':MOTD}) cr.add_section('uscbsrv') cr.add_section('announce') # check for config file try: a = len(cr.read(CONFIGFILE)) if a == 0: print('No config file found - loading default values.') except e: print('Error reading config: ' + str(e)) self.timetick = strops.confopt_posint(cr.get('announce', 'timetick'), TIMETICK) self.fontsize = strops.confopt_posint(cr.get('announce', 'fontsize'), FONTSIZE) self.motd = cr.get('announce', 'motd') if strops.confopt_bool(cr.get('announce', 'fullscreen')): self.window.fullscreen() nhost = cr.get('uscbsrv', 'host') nport = strops.confopt_posint(cr.get('uscbsrv', 'port'), USCBSRV_PORT) nchannel = cr.get('uscbsrv', 'channel') ncltnick =cr.get('uscbsrv', 'cltnick') nsrvnick = cr.get('uscbsrv', 'srvnick') self.io.set_port(nhost, nport, nchannel, ncltnick, nsrvnick) fnszstr = str(self.fontsize)+'px' self.lbl_header.modify_font(pango.FontDescription('bold '+fnszstr)) self.elap_lbl.modify_font(pango.FontDescription('monospace bold '+fnszstr)) self.search_lbl.modify_font(pango.FontDescription(fnszstr)) self.search_entry.modify_font(pango.FontDescription(fnszstr)) self.view.modify_font(pango.FontDescription('bold '+fnszstr))