def onPluginCommandEvent(self, serverConnectionHandlerID, pluginName, pluginCommand): _f = "Plugin message by \"" + pluginName + "\": " + pluginCommand ts3.logMessage( '{:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now()) + " " + _f, ts3defines.LogLevel.LogLevel_INFO, self.name, 0) if self.cfg.getboolean('general', 'Debug'): ts3.printMessageToCurrentTab(_f) print(_f)
def configure(self, qParentWidget): try: if not self.dlg: self.dlg = SettingsDialog(self) self.dlg.show() self.dlg.raise_() self.dlg.activateWindow() except: from traceback import format_exc ts3.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "PyTSon", 0)
def configDialogClosed(self, r, vals): try: ts3.printMessageToCurrentTab("vals: "+str(vals)) if r == QDialog.Accepted: for name, val in vals.items(): try: if not val == self.cfg.getboolean('general', name): self.cfg.set('general', str(name), str(val)) except: from traceback import format_exc ts3.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "PyTSon", 0) with open(self.ini, 'w') as configfile: self.cfg.write(configfile) except: from traceback import format_exc ts3.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "PyTSon", 0)
def configDialogClosed(self, r, vals): try: ts3.printMessageToCurrentTab("vals: " + str(vals)) if r == QDialog.Accepted: for name, val in vals.items(): try: if not val == self.cfg.getboolean('general', name): self.cfg.set('general', str(name), str(val)) except: from traceback import format_exc ts3.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "PyTSon", 0) with open(self.ini, 'w') as configfile: self.cfg.write(configfile) except: from traceback import format_exc ts3.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "PyTSon", 0)
def __init__(self): self.dlg = None if os.path.isfile(self.ini): self.cfg.read(self.ini) else: self.cfg['general'] = { "Debug": "False", "Colored": "False", "Autorequest Server Variables": "False", "Autorequest Client Variables": "False" } self.cfg.add_section('VirtualServerProperties');self.cfg.add_section('VirtualServerPropertiesRare'); self.cfg.add_section('ChannelProperties');self.cfg.add_section('ChannelPropertiesRare'); self.cfg.add_section('ClientProperties');self.cfg.add_section('ClientPropertiesRare'); self.cfg.add_section('ConnectionProperties');self.cfg.add_section('ConnectionPropertiesRare') self.cfg.set("VirtualServerProperties", "LAST_REQUESTED", "True");self.cfg.set("VirtualServerProperties", "TYPE", "True") for name, value in getmembers(ts3defines.VirtualServerProperties): if not name.startswith('__') and not '_DUMMY_' in name and not name.endswith('_ENDMARKER'): self.cfg.set("VirtualServerProperties", name, "False") for name, value in getmembers(ts3defines.VirtualServerPropertiesRare): if not name.startswith('__') and not '_DUMMY_' in name and not name.endswith('_ENDMARKER_RARE'): self.cfg.set("VirtualServerPropertiesRare", name, "False") self.cfg.set("ChannelProperties", "LAST_REQUESTED", "True");self.cfg.set("ChannelProperties", "TYPE", "True") for name, value in getmembers(ts3defines.ChannelProperties): if not name.startswith('__') and not '_DUMMY_' in name and not name.endswith('_ENDMARKER'): self.cfg.set("ChannelProperties", name, "False") for name, value in getmembers(ts3defines.ChannelPropertiesRare): if not name.startswith('__') and not '_DUMMY_' in name and not name.endswith('_ENDMARKER_RARE'): self.cfg.set("ChannelPropertiesRare", name, "False") self.cfg.set("ClientProperties", "LAST_REQUESTED", "True");self.cfg.set("ClientProperties", "TYPE", "True") for name, value in getmembers(ts3defines.ClientProperties): if not name.startswith('__') and not '_DUMMY_' in name and not name.endswith('_ENDMARKER'): self.cfg.set("ClientProperties", name, "False") for name, value in getmembers(ts3defines.ClientPropertiesRare): if not name.startswith('__') and not '_DUMMY_' in name and not name.endswith('_ENDMARKER_RARE'): self.cfg.set("ClientPropertiesRare", name, "False") for name, value in getmembers(ts3defines.ConnectionProperties): if not name.startswith('__') and not '_DUMMY_' in name and not name.endswith('_ENDMARKER'): self.cfg.set("ConnectionProperties", name, "False") for name, value in getmembers(ts3defines.ConnectionPropertiesRare): if not name.startswith('__') and not '_DUMMY_' in name and not name.endswith('_ENDMARKER_RARE'): self.cfg.set('ConnectionPropertiesRare', name, 'False') with open(self.ini, 'w') as configfile: self.cfg.write(configfile) ts3.logMessage(self.name+" script for pyTSon by "+self.author+" loaded from \""+__file__+"\".", ts3defines.LogLevel.LogLevel_INFO, "Python Script", 0) if self.cfg.getboolean('general', 'Debug'): ts3.printMessageToCurrentTab('[{:%Y-%m-%d %H:%M:%S}]'.format(datetime.datetime.now())+" [color=orange]"+self.name+"[/color] Plugin for pyTSon by [url=https://github.com/"+self.author+"]"+self.author+"[/url] loaded.")
def onPluginCommandEvent(self, serverConnectionHandlerID, pluginName, pluginCommand): _f = "Plugin message by \""+pluginName+"\": "+pluginCommand ts3.logMessage('{:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now())+" "+_f, ts3defines.LogLevel.LogLevel_INFO, self.name, 0) if self.cfg.getboolean('general', 'Debug'): ts3.printMessageToCurrentTab(_f) print(_f)
def __init__(self): self.dlg = None if os.path.isfile(self.ini): self.cfg.read(self.ini) else: self.cfg['general'] = { "Debug": "False", "Colored": "False", "Autorequest Server Variables": "False", "Autorequest Client Variables": "False" } self.cfg.add_section('VirtualServerProperties') self.cfg.add_section('VirtualServerPropertiesRare') self.cfg.add_section('ChannelProperties') self.cfg.add_section('ChannelPropertiesRare') self.cfg.add_section('ClientProperties') self.cfg.add_section('ClientPropertiesRare') self.cfg.add_section('ConnectionProperties') self.cfg.add_section('ConnectionPropertiesRare') self.cfg.set("VirtualServerProperties", "LAST_REQUESTED", "True") self.cfg.set("VirtualServerProperties", "TYPE", "True") for name, value in getmembers(ts3defines.VirtualServerProperties): if not name.startswith( '__') and not '_DUMMY_' in name and not name.endswith( '_ENDMARKER'): self.cfg.set("VirtualServerProperties", name, "False") for name, value in getmembers( ts3defines.VirtualServerPropertiesRare): if not name.startswith( '__') and not '_DUMMY_' in name and not name.endswith( '_ENDMARKER_RARE'): self.cfg.set("VirtualServerPropertiesRare", name, "False") self.cfg.set("ChannelProperties", "LAST_REQUESTED", "True") self.cfg.set("ChannelProperties", "TYPE", "True") for name, value in getmembers(ts3defines.ChannelProperties): if not name.startswith( '__') and not '_DUMMY_' in name and not name.endswith( '_ENDMARKER'): self.cfg.set("ChannelProperties", name, "False") for name, value in getmembers(ts3defines.ChannelPropertiesRare): if not name.startswith( '__') and not '_DUMMY_' in name and not name.endswith( '_ENDMARKER_RARE'): self.cfg.set("ChannelPropertiesRare", name, "False") self.cfg.set("ClientProperties", "LAST_REQUESTED", "True") self.cfg.set("ClientProperties", "TYPE", "True") for name, value in getmembers(ts3defines.ClientProperties): if not name.startswith( '__') and not '_DUMMY_' in name and not name.endswith( '_ENDMARKER'): self.cfg.set("ClientProperties", name, "False") for name, value in getmembers(ts3defines.ClientPropertiesRare): if not name.startswith( '__') and not '_DUMMY_' in name and not name.endswith( '_ENDMARKER_RARE'): self.cfg.set("ClientPropertiesRare", name, "False") for name, value in getmembers(ts3defines.ConnectionProperties): if not name.startswith( '__') and not '_DUMMY_' in name and not name.endswith( '_ENDMARKER'): self.cfg.set("ConnectionProperties", name, "False") for name, value in getmembers(ts3defines.ConnectionPropertiesRare): if not name.startswith( '__') and not '_DUMMY_' in name and not name.endswith( '_ENDMARKER_RARE'): self.cfg.set('ConnectionPropertiesRare', name, 'False') with open(self.ini, 'w') as configfile: self.cfg.write(configfile) ts3.logMessage( self.name + " script for pyTSon by " + self.author + " loaded from \"" + __file__ + "\".", ts3defines.LogLevel.LogLevel_INFO, "Python Script", 0) if self.cfg.getboolean('general', 'Debug'): ts3.printMessageToCurrentTab( '[{:%Y-%m-%d %H:%M:%S}]'.format(datetime.datetime.now()) + " [color=orange]" + self.name + "[/color] Plugin for pyTSon by [url=https://github.com/" + self.author + "]" + self.author + "[/url] loaded.")