Esempio n. 1
0
 def addItems(self, menus, processed=None):
     """
     Adds items to the completion tree from the menu.
     
     :param      menus | [<QMenu>, ..]
                 procesed | [<QAction>, ..] || None
     """
     if processed is None:
         processed = []
     
     for menu in menus:
         for action in menu.actions():
             # since we can have 1 action in more than 1 submenu, we
             # will want to make sure we're only adding a unique one
             # so we don't have duplicates
             text = nativestring(action.text())
             if text in processed or action.isSeparator():
                 continue
             
             processed.append(text)
             
             if text and unwrapVariant(action.data()) != 'menu':
                 item = XTreeWidgetItem(self._completer, [text])
                 item.setFixedHeight(20)
                 item.setIcon(0, action.icon())
                 item.setToolTip(0, action.toolTip())
                 item.setData(0, Qt.UserRole, wrapVariant(action))
Esempio n. 2
0
    def addItems(self, menus, processed=None):
        """
        Adds items to the completion tree from the menu.
        
        :param      menus | [<QMenu>, ..]
                    procesed | [<QAction>, ..] || None
        """
        if processed is None:
            processed = []

        for menu in menus:
            for action in menu.actions():
                # since we can have 1 action in more than 1 submenu, we
                # will want to make sure we're only adding a unique one
                # so we don't have duplicates
                text = nativestring(action.text())
                if text in processed or action.isSeparator():
                    continue

                processed.append(text)

                if text and unwrapVariant(action.data()) != 'menu':
                    item = XTreeWidgetItem(self._completer, [text])
                    item.setFixedHeight(20)
                    item.setIcon(0, action.icon())
                    item.setToolTip(0, action.toolTip())
                    item.setData(0, Qt.UserRole, wrapVariant(action))
Esempio n. 3
0
 def __init__(self, loggerWidget):
     super(XLoggerControls, self).__init__(loggerWidget)
     
     # load the user interface
     projexui.loadUi(__file__, self)
     
     self._url = 'https://docs.python.org/2/library/logging.html#logrecord-attributes'
     self._loggerWidget = loggerWidget
     self.uiLoggerTREE.setLoggerWidget(loggerWidget)
     self.uiFormatTXT.setText(loggerWidget.formatText())
     
     # load the levels
     if 'designer' not in sys.executable:
         tree = self.uiLevelTREE
         from projexui.widgets.xloggerwidget import XLoggerWidget
         items = sorted(XLoggerWidget.LoggingMap.items())
         for i, (level, data) in enumerate(items):
             item = XTreeWidgetItem(tree, [projex.text.pretty(data[0])])
             item.setFixedHeight(22)
             item.setData(0, QtCore.Qt.UserRole, wrapVariant(level))
             item.setCheckState(0, QtCore.Qt.Unchecked)
     
     # create connections
     self.uiFormatTXT.textChanged.connect(loggerWidget.setFormatText)
     self.uiLevelTREE.itemChanged.connect(self.updateLevels)
     self.uiHelpBTN.clicked.connect(self.showHelp)
Esempio n. 4
0
 def __init__(self, loggerWidget):
     super(XLogRecordControls, self).__init__(loggerWidget)
     
     # load the user interface
     projexui.loadUi(__file__, self)
     
     self._loggerWidget = loggerWidget
     self.uiLoggerTREE.setLoggerWidget(loggerWidget)
     
     # load the levels
     if 'designer' not in sys.executable:
         tree = self.uiLevelTREE
         from projexui.widgets.xloggerwidget import XLoggerWidget
         items = sorted(XLoggerWidget.LoggingMap.items())
         for i, (level, data) in enumerate(items):
             item = XTreeWidgetItem(tree, [projex.text.pretty(data[0])])
             item.setFixedHeight(22)
             item.setData(0, QtCore.Qt.UserRole, wrapVariant(level))
             item.setCheckState(0, QtCore.Qt.Unchecked)
     
     # create connections
     self.uiLevelTREE.itemChanged.connect(self.updateLevels)