Example #1
0
    def __del__(self):
        PluginHost.unregisterCallbackProxy(self)
        self.allchans = {}
        self.objs = {}

        if self.iconpackcreated:
            self.iconpack.close()

        self.countries.close()
Example #2
0
    def __del__(self):
        PluginHost.unregisterCallbackProxy(self)
        self.allchans = {}
        self.objs = {}

        if self.iconpackcreated:
            self.iconpack.close()

        self.countries.close()
Example #3
0
 def checkServer(self):
     if self.schid > 0: (err, status) = ts3lib.getConnectionStatus(self.schid)
     else: status = ts3defines.ConnectStatus.STATUS_DISCONNECTED
     try:
         if status == ts3defines.ConnectStatus.STATUS_DISCONNECTED:
             ts3lib.setPluginMenuEnabled(PluginHost.globalMenuID(self, self.menuItems[0][1]), True)
             ts3lib.setPluginMenuEnabled(PluginHost.globalMenuID(self, self.menuItems[1][1]), False)
         elif status == ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHED:
             ts3lib.setPluginMenuEnabled(PluginHost.globalMenuID(self, self.menuItems[0][1]), False)
             ts3lib.setPluginMenuEnabled(PluginHost.globalMenuID(self, self.menuItems[1][1]), True)
     except: pass
Example #4
0
    def __init__(self, schid, iconpack=None, parent=None):
        """
        Instantiates a new ServerviewModel object. This raises an exception if
        the iconpack could not be opened. The object registers itself as
        callbackproxy to the PythonHost.
        @param schid: the ID of the serverconnection
        @type schid: int
        @param iconpack: the iconpack to use icons from. defaults to None to
        use the TS3 client's current IconPack
        @type iconpack: ts3client.IconPack
        @param parent: the QObject-parent. defaults to None
        @type parent: QObject
        """
        super().__init__(parent)

        self.schid = schid
        self.root = Server(schid)

        self.allchans = {}
        self.allclients = {}
        self.objs = {}

        self.cgicons = {}
        self.sgicons = {}

        self._reload()

        try:
            self.icons = ts3client.ServerCache(self.schid)

            self.countries = ts3client.CountryFlags()
            self.countries.open()
        except Exception as e:
            self.delete()
            raise e

        self.iconpackcreated = False
        if not iconpack:
            try:
                self.iconpack = ts3client.IconPack.current()
                self.iconpack.open()
                self.iconpackcreated = True
            except Exception as e:
                self.delete()
                raise e
        else:
            self.iconpack = iconpack

        PluginHost.registerCallbackProxy(self)
Example #5
0
    def __init__(self, schid, iconpack=None, parent=None):
        """
        Instantiates a new ServerviewModel object. This raises an exception if
        the iconpack could not be opened. The object registers itself as
        callbackproxy to the PythonHost.
        @param schid: the ID of the serverconnection
        @type schid: int
        @param iconpack: the iconpack to use icons from. defaults to None to
        use the TS3 client's current IconPack
        @type iconpack: ts3client.IconPack
        @param parent: the QObject-parent. defaults to None
        @type parent: QObject
        """
        super().__init__(parent)

        self.schid = schid
        self.root = Server(schid)

        self.allchans = {}
        self.allclients = {}
        self.objs = {}

        self.cgicons = {}
        self.sgicons = {}

        self._reload()

        try:
            self.icons = ts3client.ServerCache(self.schid)

            self.countries = ts3client.CountryFlags()
            self.countries.open()
        except Exception as e:
            self.delete()
            raise e

        self.iconpackcreated = False
        if not iconpack:
            try:
                self.iconpack = ts3client.IconPack.current()
                self.iconpack.open()
                self.iconpackcreated = True
            except Exception as e:
                self.delete()
                raise e
        else:
            self.iconpack = iconpack

        PluginHost.registerCallbackProxy(self)
Example #6
0
 def toggleMenus(self, enabled):
     for menuItem in self.menuItems:
         try:
             ts3lib.setPluginMenuEnabled(
                 PluginHost.globalMenuID(self, menuItem[1]), enabled)
         except:
             pass
Example #7
0
 def menuCreated(self):
     if not self.name in PluginHost.active: return
     for id in [0, 5]:
         try:
             ts3lib.setPluginMenuEnabled(PluginHost.globalMenuID(self, id),
                                         False)
         except:
             pass
Example #8
0
 def checkServer(self, schid=0, status=None):
     if schid < 1: schid = ts3lib.getCurrentServerConnectionHandlerID()
     if status is None: (err, status) = ts3lib.getConnectionStatus(schid)
     if status == ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHED:
         status = True
     elif status == ts3defines.ConnectStatus.STATUS_DISCONNECTED:
         status = False
     else:
         return
     for menuItem in self.menuItems:
         try:
             ts3lib.setPluginMenuEnabled(
                 PluginHost.globalMenuID(self, menuItem[1]), status)
         except:
             pass
Example #9
0
 def __init__(self):
     #keep in mind, that this plugin won't show as enabled on client startup
     PluginHost.configure(None)