Пример #1
0
 def test_setActionIcon(self, qtbot):
     mw = SpotMotionMonitor()
     qtbot.addWidget(mw)
     action = QAction()
     mw.setActionIcon(action, "test.png", True)
     assert action.icon() is not None
     assert action.isIconVisibleInMenu() is True
Пример #2
0
 def setup(self):
     self.menus = {}
     self.menuItems = {}
     for menu in self.config['menus']:
         menuData = self.config['menus'][menu]
         menuName = menuData['name']
         menuObj = self.addMenu(menuName)
         self.menus.update({menuName: menuObj})
         self.menuItems.update({menuName: {}})
         for action in menuData['actions']:
             actionData = menuData['actions'][action]
             actName = actionData['name']
             actTarget = actionData['target']
             icon = actionData['icon']
             if icon == 'None':
                 actObj = QAction(QIcon(''), actName)
                 actObj.triggered.connect(lambda x, y=action, z=actTarget:
                                          self.signal.emit({
                                              'target': z,
                                              'action': y
                                          }))
                 actObj.isIconVisibleInMenu = False
                 menuObj.addAction(actObj)
                 self.menuItems[menuName].update({action: actObj})