Exemplo n.º 1
0
 def _init_window(self):
     # Load core stylesheet
     stylepath = os.path.join(SHAREDIR, 'pkmeter.css')
     with open(stylepath) as handle:
         self.setStyleSheet(handle.read())
     # Init self properties
     self.setWindowTitle('PKMeter Preferences')
     self.setWindowModality(Qt.ApplicationModal)
     self.setWindowIcon(QtGui.QIcon(QtGui.QPixmap('img:logo.png')))
     self.layout().setContentsMargins(10, 10, 10, 10)
     # Init window elements
     self.manifest.tabbar.setExpanding(False)
     self.manifest.tabbar.addTab('Settings')
     self.manifest.tabbar.addTab('Data')
     self.manifest.contents.setSizePolicy(
         QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
                               QtWidgets.QSizePolicy.Expanding))
     self.manifest.tabbar.currentChanged.connect(self.load_tab)
     # Init the ListWidget
     listwidget = self.manifest.list
     for module in sorted(self.pkmeter.modules.values(),
                          key=lambda m: utils.name(m)):
         if getattr(module, 'Plugin', None) or getattr(
                 module, 'Config', None):
             item = QtWidgets.QListWidgetItem(utils.name(module),
                                              parent=listwidget,
                                              type=0)
             item.setData(NAMESPACE_ROLE, utils.namespace(module))
             listwidget.addItem(item)
     self.manifest.list.itemSelectionChanged.connect(self.load_tab)
Exemplo n.º 2
0
 def _init_window(self):
     # Load core stylesheet
     stylepath = os.path.join(SHAREDIR, 'pkmeter.css')
     with open(stylepath) as handle:
         self.setStyleSheet(handle.read())
     # Init self properties
     self.setWindowTitle('PKMeter Preferences')
     self.setWindowModality(Qt.ApplicationModal)
     self.setWindowIcon(QtGui.QIcon(QtGui.QPixmap('img:logo.png')))
     self.layout().setContentsMargins(10,10,10,10)
     # Init window elements
     self.manifest.tabbar.setExpanding(False)
     self.manifest.tabbar.addTab('Settings')
     self.manifest.tabbar.addTab('Data')
     self.manifest.contents.setSizePolicy(QtWidgets.QSizePolicy(
         QtWidgets.QSizePolicy.Expanding,
         QtWidgets.QSizePolicy.Expanding))
     self.manifest.tabbar.currentChanged.connect(self.load_tab)
     # Init the ListWidget
     listwidget = self.manifest.list
     for module in sorted(self.pkmeter.modules.values(), key=lambda m:utils.name(m)):
         if getattr(module, 'Plugin', None) or getattr(module, 'Config', None):
             item = QtWidgets.QListWidgetItem(utils.name(module), parent=listwidget, type=0)
             item.setData(NAMESPACE_ROLE, utils.namespace(module))
             listwidget.addItem(item)
     self.manifest.list.itemSelectionChanged.connect(self.load_tab)
Exemplo n.º 3
0
 def __init__(self, pkmeter, pkconfig):
     self.name = utils.name(self.__module__)                     # Name of this Plugin
     self.namespace = utils.namespace(self.__module__)           # Namespace of this Config
     self.template = self._init_template()                       # Template for config settings
     self.fields = utils.Bunch()                                 # Fields in this Config
     PKVFrame.__init__(self, self.template, self)                # Init parent widget
     self.pkmeter = pkmeter                                      # Reference to PKMeter
     self.pkconfig = pkconfig                                    # Reference to Main Config
     self._init_default_interval()
     self._init_fields()
Exemplo n.º 4
0
 def __init__(self, pkmeter, *args, **kwargs):
     super(BasePlugin, self).__init__(*args, **kwargs)
     self.daemon = True                                          # Set as daemon thread
     self.name = utils.name(self.__module__)                     # Name of this Plugin
     self.namespace = utils.namespace(self.__module__)           # Namespace of this Plugin
     self.pkmeter = pkmeter                                      # Reference to PKMeter
     self.enabled = False                                        # False if plugin disabled
     self.interval = self.get_interval()                         # Get the current interval
     self.next_update = time.time()                              # Update immediatly
     self.data = {'interval':self.interval}                      # Data returned to PKMeter
Exemplo n.º 5
0
 def __init__(self, pkmeter, pkconfig):
     self.name = utils.name(self.__module__)  # Name of this Plugin
     self.namespace = utils.namespace(
         self.__module__)  # Namespace of this Config
     self.template = self._init_template()  # Template for config settings
     self.fields = utils.Bunch()  # Fields in this Config
     PKVFrame.__init__(self, self.template, self)  # Init parent widget
     self.pkmeter = pkmeter  # Reference to PKMeter
     self.pkconfig = pkconfig  # Reference to Main Config
     self._init_default_interval()
     self._init_fields()
Exemplo n.º 6
0
 def __init__(self, pkmeter, *args, **kwargs):
     super(BasePlugin, self).__init__(*args, **kwargs)
     self.daemon = True  # Set as daemon thread
     self.name = utils.name(self.__module__)  # Name of this Plugin
     self.namespace = utils.namespace(
         self.__module__)  # Namespace of this Plugin
     self.pkmeter = pkmeter  # Reference to PKMeter
     self.enabled = False  # False if plugin disabled
     self.interval = self.get_interval()  # Get the current interval
     self.next_update = time.time()  # Update immediatly
     self.data = {'interval': self.interval}  # Data returned to PKMeter
Exemplo n.º 7
0
 def _sortKey(self, module):
     name = utils.name(module).lower()
     return '__pkmeter' if name == 'pkmeter' else name