Esempio n. 1
0
        QMainWindow.__init__(self)
        self.menu = menu
        self.game_app = game_app
        self.layout().addWidget(menu)
        self.layout().addWidget(game_app)
        self.setMinimumSize(800, 500)

    def resizeEvent(self, *args, **kwargs):
        self.menu.resize(self.size())
        self.game_app.resize(self.size())


if __name__ == '__main__':
    app = QApplication(sys.argv)
    settings = QSettings('0GNM', 'findZbomb')
    m = Menu()
    game_app = GameApp(m, settings)
    game_app.hide()
    m.game_app = game_app
    widget = Window(m, game_app)
    widget.setWindowIcon(QIcon('images/bomb.png'))
    widget.setWindowTitle('findZbomb!')
    widget.show()
    try:
        app.exec_()
    except Exception, e:
        print e
    finally:
        game_app.settings.sync()
        sys.exit(0)
Esempio n. 2
0
def getIcon(resource_name):
    return QIcon(getResourcePath(resource_name))
Esempio n. 3
0
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)

        # Set window Icon
        self.setWindowTitle(__appname__)
        iconImage = QImage(iconByteArray)
        iconPixmap = QPixmap(iconImage)
        self.setWindowIcon(QIcon(iconPixmap))

        # Set up private key format widgets
        privateKeyFormatLayout = QHBoxLayout()
        privateKeyFormatLabel = QLabel('Select Key Format: ')
        self.privateKeyTypeCombobox = QComboBox()
        self.privateKeyTypeCombobox.addItems(privateKeyFormats)
        self.privateKeyLengthLabel = QLabel('0')
        privateKeyFormatLayout.addWidget(privateKeyFormatLabel)
        privateKeyFormatLayout.addWidget(self.privateKeyTypeCombobox)
        privateKeyFormatLayout.addWidget(self.privateKeyLengthLabel)

        # Set up private key text widgets
        privateKeyLayout = QVBoxLayout()
        privateKeyButtonsLayout = QHBoxLayout()
        generatePrivateKeyButton = QPushButton('Generate Key')
        generatePrivateKeyButton.clicked.connect(self.get_private_key)
        self.copyPrivateKeyButton = QPushButton('Copy Key')
        self.copyPrivateKeyButton.setDisabled(True)
        self.copyPrivateKeyButton.clicked.connect(self.copy_private_key)
        privateKeyButtonsLayout.addWidget(generatePrivateKeyButton)
        privateKeyButtonsLayout.addWidget(self.copyPrivateKeyButton)
        self.privateKeyEdit = GrowingTextEdit()
        self.privateKeyEdit.setFont(QFont('Courier'))
        self.privateKeyEdit.textChanged.connect(
            self.private_key_or_code_changed)
        privateKeyLayout.addLayout(privateKeyButtonsLayout)
        privateKeyLayout.addWidget(self.privateKeyEdit)

        # Set up cypher code widgets
        codeLayout = QHBoxLayout()
        codeLabel = QLabel('Select Cypher Code: ')
        self.codeSelect = QSpinBox()
        self.codeSelect.setValue(10)
        self.codeSelect.setMinimum(2)
        self.codeSelect.setDisabled(True)
        self.codeSelect.valueChanged.connect(self.private_key_or_code_changed)
        codeLayout.addWidget(codeLabel)
        codeLayout.addWidget(self.codeSelect)

        # Set up cypher text widgets
        cypherLayout = QVBoxLayout()
        cypherButtonsLayout = QHBoxLayout()
        cardButtonsLayout = QHBoxLayout()
        self.generateCypherButton = QPushButton('Generate Cypher')
        self.generateCypherButton.clicked.connect(self.get_cypher)
        self.generateCypherButton.setDisabled(True)
        self.copyCypherButton = QPushButton('Copy Cypher')
        self.copyCypherButton.setDisabled(True)
        self.copyCypherButton.clicked.connect(self.copy_cypher)
        cypherButtonsLayout.addWidget(self.generateCypherButton)
        cypherButtonsLayout.addWidget(self.copyCypherButton)
        self.cypherEdit = GrowingTextEdit()
        self.cypherEdit.setFont(QFont('Courier'))
        self.cypherEdit.setReadOnly(True)
        self.cypherEdit.setVisible(False)
        self.cypherEdit.textChanged.connect(self.resize_window)
        self.cypherPreviewLabel = QLabel('-CYPHER PREVIEW-')
        self.cypherPreviewLabel.setAlignment(Qt.AlignCenter)
        self.cypherPreviewLabel.setVisible(False)
        self.cypherPreview = GrowingTextEdit()
        self.cypherPreview.setFont(QFont('Courier'))
        self.cypherPreview.setAlignment(Qt.AlignHCenter)
        self.cypherPreview.setWordWrapMode(QTextOption.NoWrap)
        self.cypherPreview.setReadOnly(True)
        self.cypherPreview.setVisible(False)
        self.cypherCardsPrintButton = QPushButton('Print Cypher Cards')
        self.cypherCardsPrintButton.setVisible(False)
        self.cypherCardsPrintButton.clicked.connect(partial(self.cards, True))
        self.cypherCardsCopyButton = QPushButton('Copy Cypher Cards')
        self.cypherCardsCopyButton.setVisible(False)
        self.cypherCardsCopyButton.clicked.connect(partial(self.cards, False))
        cardButtonsLayout.addWidget(self.cypherCardsPrintButton)
        cardButtonsLayout.addWidget(self.cypherCardsCopyButton)
        cypherLayout.addLayout(cypherButtonsLayout)
        cypherLayout.addWidget(self.cypherEdit)
        cypherLayout.addWidget(self.cypherPreviewLabel)
        cypherLayout.addWidget(self.cypherPreview)
        cypherLayout.addLayout(cardButtonsLayout)

        # Set up donation widgets
        donationsLayout = QVBoxLayout()
        separater = QFrame()
        separater.setFrameShape(QFrame.HLine)
        self.donationButton = QPushButton('Donate')
        self.donationButton.setVisible(False)
        self.donationButton.clicked.connect(self.donate)
        self.copyEthAddressButton = QPushButton('ETH: Copy Address')
        self.copyEthAddressButton.clicked.connect(
            self.copy_eth_donation_address)
        self.copyEthAddressButton.setVisible(False)
        self.copyBtcAddressButton = QPushButton('BTC: Copy Address')
        self.copyBtcAddressButton.clicked.connect(
            self.copy_btc_donation_address)
        self.copyBtcAddressButton.setVisible(False)
        donationsLayout.addWidget(separater)
        donationsLayout.addWidget(self.donationButton)
        donationsLayout.addWidget(self.copyEthAddressButton)
        donationsLayout.addWidget(self.copyBtcAddressButton)

        # Add all widgets and sub-layouts to the master layout
        self.master_layout = QVBoxLayout()
        self.master_layout.addLayout(privateKeyFormatLayout)
        self.master_layout.addLayout(privateKeyLayout)
        self.master_layout.addLayout(codeLayout)
        self.master_layout.addLayout(cypherLayout)
        self.master_layout.addLayout(donationsLayout)
        self.master_widget = QWidget()
        self.master_widget.setLayout(self.master_layout)
        self.setCentralWidget(self.master_widget)

        # Start and connect the window resizing thread
        self.worker = Worker()
        self.worker.updateWindowSize.connect(self.resize_window)
Esempio n. 4
0
    def initUI(self):

        # textEdit = QTextEdit()
        # self.setCentralWidget(textEdit)

        # self.setStyleSheet("QGroupBox {  border: 1px solid gray; padding: 5px;}");

        # Action to quit program
        exitAction = QAction(QIcon(None), 'Quit', self)
        exitAction.setShortcut('Ctrl+Q')
        exitAction.setStatusTip('Exit application')
        exitAction.triggered.connect(self.close)

        # # Action to update device list
        # self.refreshAction = QAction(QIcon('img/reload.png'), 'Refresh', self)
        # self.refreshAction.setShortcut('F5')
        # self.refreshAction.setStatusTip('Refresh list of connected devices.')
        # self.refreshAction.triggered.connect(self.updateDeviceList)

        # Action to show program information
        helpAction = QAction(QIcon(None), 'Help', self)
        helpAction.setShortcut('F1')
        helpAction.triggered.connect(self.showHelpDialog)

        # Action to help
        aboutAction = QAction(QIcon(None), 'About', self)
        aboutAction.triggered.connect(self.showAboutDialog)

        self.statusBar()

        # Add the file menu
        menubar = self.menuBar()
        fileMenu = menubar.addMenu('&File')
        # fileMenu.addAction(self.refreshAction)
        fileMenu.addAction(exitAction)
        fileMenu = menubar.addMenu('&Help')
        fileMenu.addAction(helpAction)
        fileMenu.addAction(aboutAction)

        # # Add the toolbar
        # toolbar = self.addToolBar('Exit')
        # # toolbar.addAction(self.refreshAction)
        # toolbar.setMovable(False)

        # Add the main windows widgets
        self.deviceListWidget = DeviceList(self.programDeviceHandler,
                                           self.infoDeviceHandler,
                                           self.resetDeviceHandler)
        self.fileSelectorWidget = FileSelector()

        self.setStyleSheet("""
            QStatusBar {
                border-top: 1px solid #CCC;
            }
            QToolBar {
                border-top: 1px solid #DDD;
                border-bottom: 1px solid #CCC;
            }
        """)

        gbox = QGroupBox("Connected USB devices:")
        gboxLayout = QVBoxLayout()
        gboxLayout.addWidget(self.deviceListWidget)
        gbox.setLayout(gboxLayout)

        self.refreshEvent = QTimer()
        self.refreshEvent.setInterval(1250)
        self.refreshEvent.timeout.connect(self.USBUpdate)
        self.refreshEvent.start()

        layout = QVBoxLayout()
        layout.addWidget(self.fileSelectorWidget)
        layout.addWidget(gbox)
        self.setCentralWidget(QWidget())
        self.centralWidget().setLayout(layout)

        self.setMinimumSize(620, 700)
        self.setMaximumWidth(620)
        self.setWindowFlags(Qt.Window | Qt.WindowMinimizeButtonHint
                            | Qt.WindowCloseButtonHint)

        self.setGeometry(300, 300, 350, 250)
        self.setWindowTitle('keyplus layout and firmware loader')
        self.show()
Esempio n. 5
0
    def __launch(self):
        """This function generates and displays the MultiCopy GUI interface.

        It creates all the dialog boxes for user interaction and input.
        """
        self.main_dialog = gui.PySideUic.loadUi(
            app.getUserMacroDir(True) + '/MultiCopy/resources/MultiCopy_Main_Dialog.ui'
        )
        objects_list_textbox = self.main_dialog.findChild(
            QTextEdit, 'objects_list_textbox'
        )
        commands_input_textbox = self.main_dialog.findChild(
            QPlainTextEdit, 'commands_input_textbox'
        )
        # Adds a filter to detect Paste Code Commands changes in the 'commands_input_textbox' and
        # validate the same.
        _filter = Filter()
        _filter.sendObject(self)
        commands_input_textbox.installEventFilter(_filter)
        # Inserts the list of selected FreeCAD objects into the 'objects_list_textbox'.
        objects_list_textbox_text = '<table>'
        for i_, selected_obj in enumerate(self.selected_objs, 1):
            objects_list_textbox_text += (
                '<tr><td>['
                + str(i_)
                + ']</td><td>&nbsp;&nbsp;'
                + selected_obj.Label
                + '</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&#60;'
                + str(selected_obj.TypeId).replace('\'', '')
                + '&#62;</td></tr>'
            )
        objects_list_textbox_text += '</table>'
        objects_list_textbox.setHtml(objects_list_textbox_text)
        commands_input_textbox.setPlainText('from ')
        commands_input_textbox.moveCursor(QTextCursor.End, QTextCursor.MoveAnchor)
        self.__numbering_type_radios_clicked()
        for docElem in self.list_of_documents:
            self.main_dialog.findChild(QComboBox, 'documents_list_combobox').addItem(
                app.getDocument(docElem).Label
            )
        self.main_dialog.findChild(
            QRadioButton, 'numbering_type_n_radio'
        ).clicked.connect(lambda: self.__numbering_type_radios_clicked())
        self.main_dialog.findChild(
            QRadioButton, 'numbering_type_ru_radio'
        ).clicked.connect(lambda: self.__numbering_type_radios_clicked())
        self.main_dialog.findChild(
            QRadioButton, 'numbering_type_rl_radio'
        ).clicked.connect(lambda: self.__numbering_type_radios_clicked())
        self.main_dialog.findChild(
            QRadioButton, 'numbering_type_au_radio'
        ).clicked.connect(lambda: self.__numbering_type_radios_clicked())
        self.main_dialog.findChild(
            QRadioButton, 'numbering_type_al_radio'
        ).clicked.connect(lambda: self.__numbering_type_radios_clicked())
        self.main_dialog.findChild(
            QCheckBox, 'delete_selections_check'
        ).toggled.connect(lambda: self.__delete_selections_check_toggled())
        self.main_dialog.findChild(QCheckBox, 'add_separator_check').toggled.connect(
            lambda: self.__add_separator_check_toggled()
        )
        self.main_dialog.findChild(QCheckBox, 'add_padding_check').toggled.connect(
            lambda: self.__add_padding_check_toggled()
        )
        self.main_dialog.findChild(QPushButton, 'paste_button').clicked.connect(
            lambda: self.__paste_button_clicked()
        )
        self.main_dialog.findChild(QTabWidget, 'tabset').currentChanged.connect(
            lambda: self.__tabset_tab_toggled()
        )
        self.main_dialog.findChild(QPushButton, 'command_list_button').clicked.connect(
            launch_commands_list_dialog
        )
        self.main_dialog.findChild(QPushButton, 'close_button').clicked.connect(
            lambda: self.main_dialog.done(1)
        )
        self.main_dialog.setWindowIcon(
            QIcon(app.getUserMacroDir(True) + '/MultiCopy/resources/MultiCopy.svg')
        )
        self.main_dialog.exec_()
Esempio n. 6
0
 def _setTabIcon(self, tabIndex, iconPath):  # maybe a url too
     """Pre-configured with the tab index, this handler always knows about
    it's widget"""
     self._tab_widget.setTabIcon(tabIndex, QIcon(iconPath))
Esempio n. 7
0
 def __init__(self):
     QMainWindow.__init__(self)
     self.setWindowTitle("Main Window")
     self.setGeometry(300, 250, 400, 300)
     self.setWindowIcon(QIcon('Stock/appicon.png'))
Esempio n. 8
0
    def process_clicked(self):

        dict_result = {}

        list_file_name = []
        for index in xrange(self.ui.listWidget.count()):

            arquivo = self.ui.listWidget.item(index).text()
            list_file_name.append(arquivo)

        list_of_tuples_mass_and_windows = []
        for index in xrange(self.ui.treeWidget.topLevelItemCount()):

            item = self.ui.treeWidget.topLevelItem(index)

            list_of_tuples_mass_and_windows.append(
                (float(item.text(0)), float(item.text(1)),
                 float(item.text(2).split(",")[0]),
                 str(item.text(2).split(",")[1])))

        list_of_tuples_mass_and_windows_thresould = self.RemoveRepetidosLista(
            list_of_tuples_mass_and_windows)

        find_peaks = ImportThermoFile(
            list_of_tuples_mass_and_windows_thresould, list_file_name,
            dict_result)

        find_peaks.start()

        find_peaks.join()

        icon_reader = QIcon(":/icons/images/find.png")
        icon_readerII = QPixmap(":/icons/images/find.png")
        message = QMessageBox()

        if len(dict_result.keys()) > 0:

            try:
                MzMatches_To_Report(dict_result)

                message.setIconPixmap(icon_readerII)
                message.setText('Success')
                message.setWindowIcon(icon_reader)
                message.setWindowTitle("Success")
                message.exec_()

            except:

                message.setIconPixmap(icon_readerII)
                message.setText('Ups something went wrong')
                message.setWindowIcon(icon_reader)
                message.setWindowTitle("Success")
                message.exec_()

        else:

            message.setIconPixmap(icon_readerII)
            message.setText('Sorry no matches found')
            message.setWindowIcon(icon_reader)
            message.setWindowTitle("No matches")
            message.exec_()
Esempio n. 9
0
 def icon(cls):
     return QIcon(':/data/subsegment_icon.png')
Esempio n. 10
0
 def setIcon(self):
     appIcon = QIcon()
     self.setWindowIcon(appIcon)
Esempio n. 11
0
    def __init__(self, parent=None):
        """
        Default class constructor.

        :param `parent`: Pointer to a parent widget instance.
        :type `parent`: `QWidget`_
        """
        super(AboutDialog, self).__init__(parent)

        p = self.palette()
        p.setColor(self.backgroundRole(), Qt.white)
        self.setPalette(p)

        if parent:
            self.gImgDir = parent.gImgDir
            self.gIconDir = parent.gIconDir
        elif __name__ == '__main__':
            self.gImgDir = gAppDir + os.sep + 'images'
            self.gIconDir = gAppDir + os.sep + 'icons' + os.sep + 'default'

        # The tiled theme background texture.
        self.bgLogo = QPixmap(self.gImgDir + os.sep + 'texture-spirals.png')
        self.bgBrush = QBrush(self.bgLogo)
        self.setWhatsThis(
            self.tr("""\
The background is a tiled image of an actual design that was stitched out during the pre-alpha stage.
It was created by Nina Paley and Theodore Gray using Mathematica in conjunction with our software.
They have graciously allowed us to use it for the project in whichever way we wish.
We thought it looked so good, that it has become the new theme for Embroidermodder 2.
To check out some of the more interesting embroidery projects they are working on,
visit http://blog.ninapaley.com/"""))

        self.imgLbl = EmbroidermodderLogo(self)

        aboutLbl = QTextBrowser(self)
        aboutLbl.setReadOnly(True)
        aboutLbl.setOpenExternalLinks(True)

        aboutLbl.setText('<b>%s</b>' % '<br>'.join(ABOUT.split('\n')))
        aboutLbl.setWhatsThis(
            self.
            tr('This is the AWESOME people that brought Embroidermodder 2 to life.'
               ))

        # We want very slight opacity of the white background
        # so the seamless texture shows slightly through.
        opacityStyleSheet = """\
        QTextEdit:read-only {
            color: rgb(50, 50, 50);
            font-size: 12px;
            font-weight: bold;
            background-color: rgba(255, 255, 255, 240);
            border: 1px solid rgba(0, 0, 0, 255);
            }
            """

        aboutLbl.setStyleSheet(opacityStyleSheet)
        op = QGraphicsOpacityEffect(aboutLbl)
        op.setOpacity(0.95)
        aboutLbl.setGraphicsEffect(op)

        self.notebook = QTabWidget(self)
        self.notebook.setMinimumWidth(500)
        self.notebook.addTab(aboutLbl, self.tr('About'))
        self.notebook.setTabIcon(0, QIcon(self.gIconDir + os.sep + 'app.png'))
        self.notebook.setTabIcon(
            1, QIcon(self.gImgDir + os.sep + 'kickstarter-logo-k-color.png'))

        notebookStyleSheet = """\
            QTabWidget::pane { /* The tab widget frame */
                border-top: 1px solid #000000;
                position: absolute;
                top: -0.5em;
            }

            QTabWidget::tab-bar {
                alignment: center;
            }

            /* Style the tab using the tab sub-control. Note that
                it reads QTabBar _not_ QTabWidget */
            QTabBar::tab {
                margin-top: 2px; /* make non-selected tabs look smaller */
                font-size: 14px;
                font-weight: bold;
                background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
                                            stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,
                                            stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);
                border: 1px solid #000000;
                /* border-bottom-color: #C2C7CB; */ /* same as the pane color */
                border-top-left-radius: 4px;
                border-top-right-radius: 4px;
                min-width: 40ex;
                min-height: 5ex;
                padding: 3px;
            }

            QTabBar::tab:selected {
                margin-top: 0px;
                font-size: 16px;
                font-weight: bold;
                background: qlineargradient(x1: 0, y1: 0, x2: 2, y2: 2,
                                            stop: 0 #0C6AB0, stop: 0.15 #55C4E6,
                                            stop: 0.15 #55C4E6, stop: 0.5 #FFFFFF,
                                            stop: 0.5 #FFFFFF, stop: 0.85 #55C4E6,
                                            stop: 0.85 #55C4E6, stop: 1.0 #0C6AB0);
                border: 1px solid #000000;
            }

            QTabBar::tab:!selected:hover {
                margin-top: 2px; /* make non-selected tabs look smaller */
                font-size: 14px;
                font-weight: bold;
                background: qlineargradient(x1: 0, y1: 0, x2: 2, y2: 2,
                                            stop: 0 #888888, stop: 0.15 #BBBBBB,
                                            stop: 0.15 #BBBBBB, stop: 0.5 #FFFFFF,
                                            stop: 0.5 #FFFFFF, stop: 0.85 #BBBBBB,
                                            stop: 0.85 #BBBBBB, stop: 1.0 #888888);
                border: 1px solid #000000;
            }

            QTabBar::tab:selected {
                border-color: #000000;
                border-bottom-color: #000000; /* same as pane color */
            }
            """

        self.notebook.setStyleSheet(notebookStyleSheet)
        self.notebook.currentChanged.connect(self.CurrentTabChanged)

        buttonbox = QDialogButtonBox(Qt.Horizontal, self)
        button = QPushButton(self)
        button.setText(self.tr("Oh, Yeah!"))
        button.setWhatsThis(
            self.tr('This is the Oh, Yeah! button!') + '\n' +
            self.tr('Oh, Yeah!'))
        buttonbox.addButton(button, QDialogButtonBox.AcceptRole)
        buttonbox.setCenterButtons(True)
        buttonbox.accepted.connect(self.accept)

        hbLayout1 = QHBoxLayout()
        hbLayout2 = QHBoxLayout()
        vbLayout = QVBoxLayout()
        hbLayout1.addStretch()
        hbLayout1.addWidget(self.imgLbl)
        hbLayout1.addStretch()
        hbLayout2.addStretch()
        hbLayout2.addWidget(self.notebook)
        hbLayout2.addStretch()
        vbLayout.addLayout(hbLayout1)
        vbLayout.addLayout(hbLayout2)
        vbLayout.addWidget(buttonbox)
        self.setLayout(vbLayout)

        self.setWindowTitle(self.tr('About Embroidermodder Version 2.0'))

        QApplication.restoreOverrideCursor(
        )  # TODO/???/PORT# don't mess with the window resize cursors.
Esempio n. 12
0

if __name__ == '__main__':
    import os
    from PySide.QtGui import QApplication
    from PySide.QtGui import QVBoxLayout

    app = QApplication([])
    mainWindow = QMainWindow()
    mainWindow.setUnifiedTitleAndToolBarOnMac(True)
    toolbar = mainWindow.addToolBar("Main")
    toolbar.setMovable(False)

    dirPath = os.path.dirname(__file__)
    basePath = os.path.join(dirPath, "../../resources/images/")
    icon = QIcon(basePath + "UserTransformButton.png")

    toolButtonLeft1 = CreateFlatButton(QAction(icon, "Left", mainWindow))
    toolButtonLeft2 = CreateFlatButton(QAction(icon, "2nd left", mainWindow))
    toolButtonRight = CreateFlatButton(QAction(icon, "Right", mainWindow))

    toolButtonCenter = QPushButton()
    toolButtonCenter.setIcon(QIcon(basePath + "LandmarkTransformButton.png"))
    toolButtonCenter.setText("Center")
    toolButtonCenter.setMinimumWidth(200)

    barWidget = ToolbarWidget()

    barWidget.addLeftItem(toolButtonLeft1)
    barWidget.addLeftItem(toolButtonLeft2)
    barWidget.addCenterItem(toolButtonCenter)
Esempio n. 13
0
    def setIcon(self):
        """ Function to set Icon
		"""
        appIcon = QIcon('icon.png')
        self.setWindowIcon(appIcon)
Esempio n. 14
0
    def _createToolBarActions(self):

        self.mostRefAction = QtGui.QAction(QIcon(self.iconp + 'most_ref.png'),
                                           '&Show most referenced functions',
                                           self,
                                           triggered=self._showMostReferenced)

        self.immCmpsAction = QtGui.QAction(
            QIcon(self.iconp + 'mark_imm_cmps.png'),
            '&Mark immediate compares within the current function. \
                Useful with parsers',
            self,
            triggered=self._markImmCompares)

        self.dwCmpsAction = QtGui.QAction(
            QIcon(self.iconp + 'globals_cmp_imm.png'),
            '&Search for global variables being compared \
                to immediate values',
            self,
            triggered=self._showDwordCompares)

        self.callsAction = QtGui.QAction(
            QIcon(self.iconp + 'graph_curr_function.png'),
            '&Show calls within the current function',
            self,
            triggered=self._callsInThisFunction)

        self.commsAction = QtGui.QAction(
            QIcon(self.iconp + 'comments_curr_function.png'),
            '&Show IDA generated comments within the current function',
            self,
            triggered=self._commentsInThisFunction)

        self.stringsAction = QtGui.QAction(
            QIcon(self.iconp + 'strings_curr_function.png'),
            '&Search references to strings within the current function',
            self,
            triggered=self._showStringXrefs)

        self.inputsAction = QtGui.QAction(
            QIcon(self.iconp + 'io_connecting_to.png'),
            '&Locate IO connecting to current function. CPU intensive!',
            self,
            triggered=self._showConnectedIO)

        self.allFuncsAction = QtGui.QAction(
            QIcon(self.iconp + 'function_list.png'),
            '&Display function list for the connect graph',
            self,
            triggered=self._showAllFunctions)

        self.connGraphAction = QtGui.QAction(
            QIcon(self.iconp + 'show_connect_graph.png'),
            '&Shows the connect graph',
            self,
            triggered=self._showConnectionGraph)

        self.dangConnAction = QtGui.QAction(
            QIcon(self.iconp + 'connect_io_danger.png'),
            '&Shows all connections between IO input and dangerous \
                functions (CPU intensive!)',
            self,
            triggered=self._showDangerousConnections)

        self.bbConnAction = QtGui.QAction(
            QIcon(self.iconp + 'connect_bb.png'),
            '&Shows all connections between selected basic blocks',
            self,
            triggered=self._showConnectedBBs)

        self.xorAction = QtGui.QAction(
            QIcon(self.iconp + 'xor_bytes.png'),
            '&XOR the selected bytes with a single byte',
            self,
            triggered=self._xorSelection)

        self.toolbar.addAction(self.mostRefAction)
        self.toolbar.addAction(self.dwCmpsAction)
        self.toolbar.addSeparator()
        self.toolbar.addAction(self.immCmpsAction)
        self.toolbar.addAction(self.callsAction)
        self.toolbar.addAction(self.commsAction)
        self.toolbar.addAction(self.stringsAction)
        self.toolbar.addSeparator()
        self.toolbar.addAction(self.inputsAction)
        self.toolbar.addAction(self.allFuncsAction)
        self.toolbar.addAction(self.connGraphAction)
        self.toolbar.addAction(self.dangConnAction)
        self.toolbar.addAction(self.bbConnAction)
        self.toolbar.addSeparator()
        self.toolbar.addAction(self.xorAction)
Esempio n. 15
0
    def createWidgets(self):
        settings = QSettings()

        self.searchLabel = QLabel("Search For")
        self.searchLineEdit = QLineEdit()
        self.tooltips.append((self.searchLineEdit, """\
<p><b>Search For editor</b></p>
<p>The text or regular expression to search for.</p>"""))
        self.searchLabel.setBuddy(self.searchLineEdit)
        self.replaceLabel = QLabel("Replace With")
        self.replaceLineEdit = QLineEdit()
        self.tooltips.append((self.replaceLineEdit, """\
<p><b>Replace With editor</b></p>
<p>The replacement text (which may include backreferences, \\1, \\2,
etc., if a regular expression search is being made).</p>"""))
        self.replaceLabel.setBuddy(self.replaceLineEdit)

        self.allEntriesRadioButton = QRadioButton("All Entries")
        self.allEntriesRadioButton.setChecked(
            bool(int(settings.value("RP/All", 1))))
        self.tooltips.append((self.allEntriesRadioButton, """\
<p><b>All Entries</b></p>
<p>If checked, the search will consider every entry in the index.</p>"""))
        self.filteredEntriesRadioButton = QRadioButton("Filtered Entries")
        self.filteredEntriesRadioButton.setChecked(
            bool(int(settings.value("RP/Filtered", 0))))
        self.tooltips.append((self.filteredEntriesRadioButton, """\
<p><b>Filtered Entries</b></p>
<p>If checked, the search will consider only those entries that are in
the current filtered view.</p>"""))
        self.considerLabel = QLabel("Consider")
        self.scopeGroup = QButtonGroup()
        self.scopeGroup.addButton(self.allEntriesRadioButton)
        self.scopeGroup.addButton(self.filteredEntriesRadioButton)

        self.literalRadioButton = QRadioButton("Literal")
        self.literalRadioButton.setChecked(
            bool(int(settings.value("RP/Literal", 1))))
        self.tooltips.append((self.literalRadioButton, """<p><b>Literal</b></p>
<p>If checked, the <b>Search For</b> text will be searched for
literally.</p>"""))
        self.regexRadioButton = QRadioButton("Regex")
        self.regexRadioButton.setChecked(
            bool(int(settings.value("RP/Regex", 0))))
        self.tooltips.append((self.regexRadioButton, """<p><b>Regex</b></p>
<p>If checked, the <b>Search For</b> text will be searched for
as a regular expression pattern.</p>"""))
        self.matchAsGroup = QButtonGroup()
        self.matchAsGroup.addButton(self.literalRadioButton)
        self.matchAsGroup.addButton(self.regexRadioButton)
        self.ignoreCaseCheckBox = QCheckBox("Ignore Case")
        self.ignoreCaseCheckBox.setChecked(
            bool(int(settings.value("RP/ICase", 0))))
        self.tooltips.append((self.ignoreCaseCheckBox, """\
<p><b>Ignore Case</b></p>
<p>If checked, the <b>Search For</b> text will be searched for
case-insensitively.</p>"""))
        self.wholeWordsCheckBox = QCheckBox("Whole Words")
        self.wholeWordsCheckBox.setChecked(
            bool(int(settings.value("RP/WW", 0))))
        self.tooltips.append((self.wholeWordsCheckBox, """\
<p><b>Whole Words</b></p>
<p>If checked&mdash;and when <b>Literal</b> is checked&mdash;the
<b>Search For</b> text will be matched as whole words.</p>
<p>For example, “habit” will not match “habitat” when whole words is
checked.</p>
<p>(For regular expressions use \\b before and after each word to get
whole word matches.)</p>"""))

        self.replaceInLabel = QLabel("Look In")
        self.replaceInTermsCheckBox = QCheckBox("Terms")
        self.replaceInTermsCheckBox.setChecked(
            bool(int(settings.value("RP/Terms", 1))))
        self.tooltips.append((self.replaceInTermsCheckBox, """\
<p><b>Terms</b></p>
<p>If checked, the search will look in term texts.</p>"""))
        self.replaceInPagesCheckBox = QCheckBox("Pages")
        self.replaceInPagesCheckBox.setChecked(
            bool(int(settings.value("RP/Pages", 0))))
        self.tooltips.append((self.replaceInPagesCheckBox, """\
<p><b>Pages</b></p>
<p>If checked, the search will look in pages texts.</p>"""))
        self.replaceInNotesCheckBox = QCheckBox("Notes")
        self.replaceInNotesCheckBox.setChecked(
            bool(int(settings.value("RP/Notes", 0))))
        self.tooltips.append((self.replaceInNotesCheckBox, """\
<p><b>Notes</b></p>
<p>If checked, the search will look in notes texts.</p>"""))
        self.startButton = QPushButton(QIcon(":/edit-find.svg"),
                                       "Start Search")
        self.tooltips.append((self.startButton, """<p><b>Start Search</b></p>
<p>Start the search from the first entry in the index or the first entry
in the filtered view's entries.</p>"""))
        self.replaceButton = QPushButton(QIcon(":/edit-find-replace.svg"),
                                         "Replace")
        self.tooltips.append((self.replaceButton, """<p><b>Replace</b></p>
<p>Replace the highlighted text with the <b>Replace With</b> text (using
backreferences if they are in the replacement text and a <b>Regex</b>
search is underway), and then try to find the next matching text.</p>"""))
        self.skipButton = QPushButton(QIcon(":/skip.svg"), "S&kip")
        self.tooltips.append((self.skipButton, """<p><b>Skip</b></p>
<p>Skip the highlighted text and try to find the next matching
text.</p>"""))
        self.stopButton = QPushButton(QIcon(":/process-stop.svg"),
                                      "Stop Search")
        self.tooltips.append((self.stopButton, """<p><b>Stop Search</b></p>
<p>Stop the current search. This allows the search options to be
changed.</p>"""))
        self.closeButton = QToolButton()
        self.closeButton.setIcon(QIcon(":/hide.svg"))
        self.closeButton.setFocusPolicy(Qt.NoFocus)
        self.tooltips.append((self.closeButton, """<p><b>Hide</b></p>
<p>Hide the Search and Replace panel.</p>
<p>Press <b>Ctrl+H</b> or click <img src=":/edit-find-replace.svg"
width={0} height={0}> or click <b>Edit→Search and Replace</b> to show it
again.</p>""".format(TOOLTIP_IMAGE_SIZE)))
        self.helpButton = QToolButton()
        self.helpButton.setIcon(QIcon(":/help.svg"))
        self.helpButton.setFocusPolicy(Qt.NoFocus)
        self.tooltips.append(
            (self.helpButton, "Help on the Search and Replace panel."))
Esempio n. 16
0
    def createActions(self):
        self.fileActions = Actions.File.Actions(self)
        self.fileMenu = self.menuBar().addMenu("&File")
        Lib.addActions(self.fileMenu, self.fileActions.forMenu())
        self.fileToolBar = self.addToolBar("File")
        self.fileToolBar.setObjectName("File")
        Lib.addActions(self.fileToolBar, self.fileActions.forToolbar())

        self.editActions = Actions.Edit.Actions(self)
        self.editMenu = self.menuBar().addMenu("&Edit")
        Lib.addActions(self.editMenu, self.editActions.forMenu())
        self.editToolBar = self.addToolBar("Edit")
        self.editToolBar.setObjectName("Edit")
        Lib.addActions(self.editToolBar, self.editActions.forToolbar())

        self.insertActions = Actions.Insert.Actions(self)
        self.insertMenu = self.menuBar().addMenu("Inse&rt")
        Lib.addActions(self.insertMenu, self.insertActions.forMenu())

        self.spellingActions = Actions.Spelling.Actions(self)
        self.spellingMenu = self.menuBar().addMenu("Spe&lling")
        Lib.addActions(self.spellingMenu, self.spellingActions.forMenu())
        self.spellingToolBar = self.addToolBar("Spelling")
        self.spellingToolBar.setObjectName("Spelling")
        Lib.addActions(self.spellingToolBar, self.spellingActions.forToolbar())

        self.formatActions = Actions.Format.Actions(self)
        self.formatMenu = self.menuBar().addMenu("F&ormat")
        Lib.addActions(self.formatMenu, self.formatActions.forMenu())
        self.formatToolBar = self.addToolBar("Format")
        self.formatToolBar.setObjectName("Format")
        Lib.addActions(self.formatToolBar, self.formatActions.forToolbar())

        self.addToolBarBreak()

        # Actions created earlier
        self.indexActions = Actions.Index.Actions(self)  # Menu added later
        self.indexToolBar = self.addToolBar("Index")
        self.indexToolBar.setObjectName("Index")
        Lib.addActions(self.indexToolBar, self.indexActions.forToolbar())

        self.gotoActions = Actions.Goto.Actions(self)
        self.gotoMenu = self.menuBar().addMenu("&Goto")
        Lib.addActions(self.gotoMenu, self.gotoActions.forMenu())
        # Goto toolbar is last

        # These actions are created in createWidgets() because two are
        # needed by the groups panel
        self.entryMenu = self.menuBar().addMenu("Entr&y")
        Lib.addActions(self.entryMenu, self.entryActions.forMenu())
        self.entryToolBar1 = self.addToolBar("Entry Add and Copy")
        self.entryToolBar1.setObjectName("Entry1")
        Lib.addActions(self.entryToolBar1, self.entryActions.forToolbar1())
        self.entryToolBar2 = self.addToolBar("Entry Cross-references")
        self.entryToolBar2.setObjectName("Entry2")
        Lib.addActions(self.entryToolBar2, self.entryActions.forToolbar2())
        self.entryToolBar3 = self.addToolBar("Entry Groups")
        self.entryToolBar3.setObjectName("Entry3")
        Lib.addActions(self.entryToolBar3, self.entryActions.forToolbar3())

        self.modifyActions = Actions.Modify.Actions(self)
        self.modifyMenu = self.menuBar().addMenu("&Modify")
        Lib.addActions(self.modifyMenu, self.modifyActions.forMenu())
        self.modifyToolBar = self.addToolBar("Modify")
        self.modifyToolBar.setObjectName("Modify")
        Lib.addActions(self.modifyToolBar, self.modifyActions.forToolbar())

        self.indexMenu = self.menuBar().addMenu("Inde&x")
        Lib.addActions(self.indexMenu, self.indexActions.forMenu())

        self.helpActions = Actions.Help.Actions(self)
        self.helpMenu = self.menuBar().addMenu("&Help")
        Lib.addActions(self.helpMenu, self.helpActions.forMenu())

        self.addToolBarBreak()

        self.gotoToolBar1 = self.addToolBar("Goto Filtered etc.")
        self.gotoToolBar1.setObjectName("Goto1")
        Lib.addActions(self.gotoToolBar1, self.gotoActions.forToolbar1())

        self.gotoToolBar2 = self.addToolBar("Goto First, Next, etc.")
        self.gotoToolBar2.setObjectName("Goto2")
        Lib.addActions(self.gotoToolBar2, self.gotoActions.forToolbar2())

        self.gotoToolBar4 = Widgets.AlphaBar.Bar()
        self.gotoToolBar4.setWindowTitle("Goto Letter")
        self.gotoToolBar4.setObjectName("Goto4")
        self.addToolBar(self.gotoToolBar4)

        self.gotoToolBar3 = self.addToolBar("Goto Bookmarks")
        self.gotoToolBar3.setObjectName("Goto3")
        Lib.addActions(self.gotoToolBar3, self.gotoActions.forToolbar3())
        self.bookmarksToolButton = QToolButton()
        self.bookmarksToolButton.setIcon(QIcon(":/bookmark.svg"))
        self.bookmarksToolButton.setPopupMode(QToolButton.InstantPopup)
        self.bookmarksToolButton.setToolTip("""\
<p><b>Goto→Bookmarks</b></p><p>Goto the bookmarked entry.""")
        self.gotoToolBar3.addWidget(self.bookmarksToolButton)

        for toolbar in (self.fileToolBar, self.editToolBar,
                        self.spellingToolBar, self.formatToolBar,
                        self.indexToolBar, self.entryToolBar1,
                        self.entryToolBar2, self.modifyToolBar,
                        self.gotoToolBar1, self.gotoToolBar2,
                        self.gotoToolBar4, self.gotoToolBar3):
            toolbar.setFloatable(False)
Esempio n. 17
0
    def __init__(self, store):
        super(ItemSelector, self).__init__()

        self.setWindowTitle('Select Item Checkpoint')

        self.store = store

        items = self.store.get('/item')

        layout = QGridLayout()
        self.setLayout(layout)

        self.item_buttons = {}

        width = 5

        label = QLabel('Selected Item')
        label.setAlignment(Qt.AlignHCenter)
        label.setStyleSheet('font-weight: bold;')
        layout.addWidget(label, 0, 0, 1, width)

        for (i, item) in enumerate(sorted(items)):
            parts = items[item]['name'].split(' ') + ['({})'.format(items[item]['location'])]
            lines = ['']
            for part in parts:
                if len(lines[-1]) > 10:
                    lines.append('')

                lines[-1] += ' ' + part

            button = QPushButton('\n'.join([line.strip() for line in lines]))
            icon = QIcon(items[item].get('thumbnail', ''))
            if not icon.isNull():
                button.setIcon(icon)
                button.setIconSize(QSize(64, 64))
            button.setCheckable(True)

            button.clicked.connect(_call(self.select_item, item))

            self.item_buttons[item] = button
            layout.addWidget(button, i // width + 1, i % width)

        self.select_item(self.store.get('/robot/selected_item'))

        self.box_buttons = {}

        label = QLabel('Selected Box')
        label.setAlignment(Qt.AlignHCenter)
        label.setStyleSheet('font-weight: bold;')
        layout.addWidget(label, 0, width + 1)

        for (i, box) in enumerate(sorted(self.store.get('/order'))):
            button = QPushButton(box)
            button.setCheckable(True)
            button.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
            button.clicked.connect(_call(self.select_box, box))

            self.box_buttons[box] = button
            layout.addWidget(button, i + 1, width + 1)

        self.select_box(self.store.get('/robot/selected_box'))

        self.bin_buttons = {}

        label = QLabel('Selected Bin')
        label.setAlignment(Qt.AlignHCenter)
        label.setStyleSheet('font-weight: bold;')
        layout.addWidget(label, 0, width + 2)

        for (i, bin) in enumerate(sorted(self.store.get('/shelf/bin'))):
            button = QPushButton(bin)
            button.setCheckable(True)
            button.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
            button.clicked.connect(_call(self.select_bin, bin))

            self.bin_buttons[bin] = button
            layout.addWidget(button, i + 1, width + 2)

        self.select_bin(self.store.get('/robot/selected_bin'))
Esempio n. 18
0
 def testAddItemWithIcon(self):
     index = self.toolbox.addItem(QWidget(), QIcon(), 'item')
     item = self.toolbox.widget(index)
     self.assert_(isinstance(item, QWidget))
Esempio n. 19
0
    def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(598, 450)
        self.icon = QIcon(":/icons/uglytheme/48x48/polibeepsync.png")
        Form.setWindowIcon(self.icon)
        Form.setLocale(QLocale(QLocale.English, QLocale.UnitedStates))
        self.verticalLayout = QVBoxLayout(Form)
        self.verticalLayout.setObjectName("verticalLayout")

        self.tabWidget = QTabWidget(Form)
        self.tabWidget.setObjectName("tabWidget")

        # Tab General Settings
        self.tab = QWidget()
        self.tab.setObjectName("tab")
        self.horizontalLayout = QHBoxLayout(self.tab)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.verticalLayout_2 = QVBoxLayout()
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.gridLayout = QGridLayout()
        self.gridLayout.setObjectName("gridLayout")
        self.label_2 = QLabel(self.tab)
        self.label_2.setObjectName("label_2")
        self.gridLayout.addWidget(self.label_2, 3, 0, 1, 1)
        self.label = QLabel(self.tab)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 1, 0, 1, 1)
        self.password = QLineEdit(self.tab)
        self.password.setMaximumSize(QSize(139, 16777215))
        self.password.setEchoMode(QLineEdit.Password)
        self.password.setObjectName("password")
        self.gridLayout.addWidget(self.password, 3, 1, 1, 1)
        self.userCode = QLineEdit(self.tab)
        self.userCode.setMaximumSize(QSize(139, 16777215))
        self.userCode.setText("")
        self.userCode.setObjectName("userCode")
        self.gridLayout.addWidget(self.userCode, 1, 1, 1, 1)
        spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                 QSizePolicy.Minimum)
        self.gridLayout.addItem(spacerItem, 1, 2, 1, 1)
        self.verticalLayout_2.addLayout(self.gridLayout)
        self.trylogin = QPushButton(self.tab)
        self.trylogin.setMaximumSize(QSize(154, 16777215))
        self.trylogin.setObjectName("trylogin")
        self.verticalLayout_2.addWidget(self.trylogin)
        self.login_attempt = QLabel(self.tab)
        self.login_attempt.setText("Logging in, please wait.")
        self.login_attempt.setStyleSheet("color: rgba(0, 0, 0, 0);")
        self.login_attempt.setObjectName("login_attempt")
        self.verticalLayout_2.addWidget(self.login_attempt)
        spacerItem1 = QSpacerItem(20, 40, QSizePolicy.Minimum,
                                  QSizePolicy.Expanding)
        self.verticalLayout_2.addItem(spacerItem1)
        self.horizontalLayout_3 = QHBoxLayout()
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.label_4 = QLabel(self.tab)
        self.label_4.setObjectName("label_4")
        self.horizontalLayout_3.addWidget(self.label_4)
        self.rootfolder = QLineEdit(self.tab)
        self.rootfolder.setMinimumSize(QSize(335, 0))
        self.rootfolder.setMaximumSize(QSize(335, 16777215))
        self.rootfolder.setInputMask("")
        self.rootfolder.setReadOnly(True)
        self.rootfolder.setObjectName("rootfolder")
        self.horizontalLayout_3.addWidget(self.rootfolder)
        self.changeRootFolder = QPushButton(self.tab)
        self.changeRootFolder.setObjectName("changeRootFolder")
        self.horizontalLayout_3.addWidget(self.changeRootFolder)
        spacerItem2 = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                  QSizePolicy.Minimum)
        self.horizontalLayout_3.addItem(spacerItem2)
        self.verticalLayout_2.addLayout(self.horizontalLayout_3)
        self.horizontalLayout_5 = QHBoxLayout()
        self.horizontalLayout_5.setObjectName("horizontalLayout_5")
        self.label_5 = QLabel(self.tab)
        self.label_5.setObjectName("label_5")
        self.horizontalLayout_5.addWidget(self.label_5)
        self.timerMinutes = QSpinBox(self.tab)
        self.timerMinutes.setObjectName("timerMinutes")
        self.horizontalLayout_5.addWidget(self.timerMinutes)
        self.label_6 = QLabel(self.tab)
        self.label_6.setObjectName("label_6")
        self.horizontalLayout_5.addWidget(self.label_6)
        self.syncNow = QPushButton(self.tab)
        self.syncNow.setObjectName("syncNow")
        self.horizontalLayout_5.addWidget(self.syncNow)
        spacerItem3 = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                  QSizePolicy.Minimum)
        self.horizontalLayout_5.addItem(spacerItem3)
        self.verticalLayout_2.addLayout(self.horizontalLayout_5)
        self.addSyncNewCourses = QCheckBox(self.tab)
        self.addSyncNewCourses.setObjectName("addSyncNewCourses")
        self.verticalLayout_2.addWidget(self.addSyncNewCourses)
        self.horizontalLayout.addLayout(self.verticalLayout_2)
        self.tabWidget.addTab(self.tab, "")

        # Tab Courses
        self.tab_2 = QWidget()
        self.tab_2.setObjectName("tab_2")
        self.horizontalLayout_2 = QHBoxLayout(self.tab_2)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.verticalLayout_3 = QVBoxLayout()
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.horizontalLayout_6 = QHBoxLayout()
        self.horizontalLayout_6.setObjectName("horizontalLayout_6")
        self.refreshCourses = QPushButton(self.tab_2)
        self.refreshCourses.setObjectName("refreshCourses")
        self.horizontalLayout_6.addWidget(self.refreshCourses)
        spacerItem4 = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                  QSizePolicy.Minimum)
        self.horizontalLayout_6.addItem(spacerItem4)
        self.verticalLayout_3.addLayout(self.horizontalLayout_6)
        self.coursesView = CoursesListView(self.tab_2)
        self.coursesView.setObjectName("coursesView")
        self.verticalLayout_3.addWidget(self.coursesView)
        self.horizontalLayout_2.addLayout(self.verticalLayout_3)
        self.tabWidget.addTab(self.tab_2, "")

        # Tab Status
        self.tab_3 = QWidget()
        self.tab_3.setObjectName("tab_3")
        self.horizontalLayout_7 = QHBoxLayout(self.tab_3)
        self.horizontalLayout_7.setObjectName("horizontalLayout_7")
        self.verticalLayout_4 = QVBoxLayout()
        self.verticalLayout_4.setObjectName("verticalLayout_4")
        self.horizontalLayout_8 = QHBoxLayout()
        self.horizontalLayout_8.setObjectName("horizontalLayout_8")
        self.about = QPushButton(self.tab_3)
        self.about.setObjectName("about")
        self.horizontalLayout_8.addWidget(self.about)
        spacerItem5 = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                  QSizePolicy.Minimum)
        self.horizontalLayout_8.addItem(spacerItem5)
        self.verticalLayout_4.addLayout(self.horizontalLayout_8)
        self.status = QTextEdit(self.tab_3)
        self.status.setTextInteractionFlags(Qt.TextSelectableByKeyboard
                                            | Qt.TextSelectableByMouse)
        self.status.setObjectName("status")
        self.verticalLayout_4.addWidget(self.status)
        self.horizontalLayout_7.addLayout(self.verticalLayout_4)
        self.tabWidget.addTab(self.tab_3, "")

        self.tab_4 = QWidget()
        self.tab_4.setObjectName("tab_4")
        self.verticalLayout.addWidget(self.tabWidget)

        self.okButton = QDialogButtonBox(Form)
        self.okButton.setStandardButtons(QDialogButtonBox.Ok)
        self.okButton.setObjectName("okButton")
        self.okButton.clicked.connect(self.hide)
        self.verticalLayout.addWidget(self.okButton)

        self.statusLabel = QLabel(Form)
        self.statusLabel.setObjectName("statusLabel")
        self.verticalLayout.addWidget(self.statusLabel)

        self.retranslateUi(Form)
        self.tabWidget.setCurrentIndex(0)
        QMetaObject.connectSlotsByName(Form)
Esempio n. 20
0
 def __init__(self,winTitle='FrameLine Manager', icon='frameline.svg'):
   super(frameLineForm,self).__init__()
   self.move(QPoint(100,250))
   self.setWindowFlags(Qt.WindowStaysOnTopHint)
   self.setWindowTitle(winTitle)
   from PySide.QtGui import QIcon
   Icon=QIcon()
   iconPath=join(dirname(abspath(__file__)),"iconz",icon)
   Icon.addFile(iconPath)
   self.setWindowIcon(Icon) 
   self.mainHL=QHBoxLayout()
   self.setLayout(self.mainHL)
   self.firstCol=QWidget()
   self.firstCol.setLayout(QVBoxLayout())
   self.lab1=QLabel('  Profiles:')
   self.firstCol.layout().addWidget(self.lab1)
   self.sectList=QListWidget()
   self.sectList.setMaximumWidth(120)
   self.updateSections()
   self.firstCol.layout().addWidget(self.sectList)
   self.cb1=QCheckBox(' Copy profile')
   self.cb1.setChecked(True)
   self.cb2=QCheckBox(' Move to origin')
   self.cb2.setChecked(True)
   self.radios=QWidget()
   self.radios.setLayout(QFormLayout())
   self.radios.layout().setAlignment(Qt.AlignHCenter)
   self.radios.layout().addRow(self.cb1)
   self.radios.layout().addRow(self.cb2)
   self.firstCol.layout().addWidget(self.radios)
   self.mainHL.addWidget(self.firstCol)
   self.secondCol=QWidget()
   self.secondCol.setLayout(QVBoxLayout())
   self.current=None    
   self.combo=QComboBox()
   self.combo.addItem('<new>')
   #self.combo.activated[str].connect(self.setCurrent)
   try:
     self.combo.addItems([o.Label for o in FreeCAD.activeDocument().Objects if hasattr(o,'FType') and o.FType=='FrameLine'])
   except:
     None
   self.combo.setMaximumWidth(100)
   self.combo.currentIndexChanged.connect(self.setCurrentFL)
   if FreeCAD.__activeFrameLine__ and FreeCAD.__activeFrameLine__ in [self.combo.itemText(i) for i in range(self.combo.count())]:
     self.combo.setCurrentIndex(self.combo.findText(FreeCAD.__activeFrameLine__))
   self.secondCol.layout().addWidget(self.combo)
   self.btn0=QPushButton('Insert')
   self.btn0.setMaximumWidth(100)
   self.secondCol.layout().addWidget(self.btn0)
   self.btn0.clicked.connect(self.insert)
   self.edit1=QLineEdit()
   self.edit1.setPlaceholderText('<name>')
   self.edit1.setAlignment(Qt.AlignHCenter)
   self.edit1.setMaximumWidth(100)
   self.secondCol.layout().addWidget(self.edit1)
   self.btn1=QPushButton('Redraw')
   self.btn1.clicked.connect(self.redraw)
   self.btn1.setMaximumWidth(100)
   self.secondCol.layout().addWidget(self.btn1)
   self.btn2=QPushButton('Get Path')
   self.btn2.clicked.connect(self.getPath)
   self.btn2.setMaximumWidth(100)
   self.secondCol.layout().addWidget(self.btn2)
   self.btn3=QPushButton('Get Profile')
   self.btn3.clicked.connect(self.getProfile)
   self.btn3.setMaximumWidth(100)
   self.secondCol.layout().addWidget(self.btn3)
   self.btn4=QPushButton('Clear')
   self.btn4.clicked.connect(self.clear)
   self.btn4.setMaximumWidth(100)
   self.secondCol.layout().addWidget(self.btn4)
   self.mainHL.addWidget(self.secondCol)
   self.show()
Esempio n. 21
0
 def _get_icon(self, node, obj, is_expanded=False):
     if not self.factory.show_disabled and not obj.enabled:
         return QIcon()
     return super(SimpleEditor, self)._get_icon(node, obj, is_expanded)
Esempio n. 22
0
 def __init__(self,
              winTitle='Title',
              PType='Pipe',
              PRating='SCH-STD',
              icon='dodo.svg',
              x=100,
              y=350):
     '''
 __init__(self,winTitle='Title', PType='Pipe', PRating='SCH-STD')
   winTitle: the window's title
   PType: the pipeFeature type
   PRating: the pipeFeature pressure rating class
 It lookups in the directory ./tablez the file PType+"_"+PRating+".csv",
 imports it's content in a list of dictionaries -> .pipeDictList and
 shows a summary in the QListWidget -> .sizeList
 Also create a property -> PRatingsList with the list of available PRatings for the 
 selected PType.   
 '''
     super(protoPypeForm, self).__init__()
     self.move(QPoint(x, y))
     self.mw = FreeCADGui.getMainWindow()
     self.PType = PType
     self.PRating = PRating
     self.setWindowFlags(Qt.WindowStaysOnTopHint)
     self.setWindowTitle(winTitle)
     iconPath = join(dirname(abspath(__file__)), "iconz", icon)
     from PySide.QtGui import QIcon
     Icon = QIcon()
     Icon.addFile(iconPath)
     self.setWindowIcon(Icon)
     self.mainHL = QHBoxLayout()
     self.setLayout(self.mainHL)
     self.firstCol = QWidget()
     self.firstCol.setLayout(QVBoxLayout())
     self.mainHL.addWidget(self.firstCol)
     self.currentRatingLab = QLabel('Rating: ' + self.PRating)
     self.firstCol.layout().addWidget(self.currentRatingLab)
     self.sizeList = QListWidget()
     self.firstCol.layout().addWidget(self.sizeList)
     self.pipeDictList = []
     self.fileList = listdir(join(dirname(abspath(__file__)), "tablez"))
     self.fillSizes()
     self.PRatingsList = [
         s.lstrip(PType + "_").rstrip(".csv") for s in self.fileList
         if s.startswith(PType) and s.endswith('.csv')
     ]
     self.secondCol = QWidget()
     self.secondCol.setLayout(QVBoxLayout())
     self.combo = QComboBox()
     self.combo.addItem('<none>')
     try:
         self.combo.addItems([
             o.Label for o in FreeCAD.activeDocument().Objects
             if hasattr(o, 'PType') and o.PType == 'PypeLine'
         ])
     except:
         None
     self.combo.currentIndexChanged.connect(self.setCurrentPL)
     if FreeCAD.__activePypeLine__ and FreeCAD.__activePypeLine__ in [
             self.combo.itemText(i) for i in range(self.combo.count())
     ]:
         self.combo.setCurrentIndex(
             self.combo.findText(FreeCAD.__activePypeLine__))
     self.secondCol.layout().addWidget(self.combo)
     self.ratingList = QListWidget()
     self.ratingList.addItems(self.PRatingsList)
     self.ratingList.itemClicked.connect(self.changeRating)
     self.ratingList.setCurrentRow(0)
     self.secondCol.layout().addWidget(self.ratingList)
     self.btn1 = QPushButton('Insert')
     self.secondCol.layout().addWidget(self.btn1)
     self.mainHL.addWidget(self.secondCol)
     self.resize(max(350, int(self.mw.width() / 4)),
                 max(350, int(self.mw.height() / 2)))
     self.mainHL.setContentsMargins(0, 0, 0, 0)
Esempio n. 23
0
def get_icon():
    return QIcon.fromTheme('everpad', QIcon('../../everpad.png'))
Esempio n. 24
0
    def __init__(self, parent):
        """
        Default class constructor.

        :param `parent`: Pointer to a parent widget instance.
        :type `parent`: `QWidget`_
        """

        super(TipOfTheDayDialog, self).__init__(parent)

        ## qDebug("TipOfTheDayDialog constructor")

        self.mainWin = parent

        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setWizardStyle(QWizard.ModernStyle)
        self.setMinimumSize(550, 400)

        ## self.setOption(QWizard.HaveHelpButton, True)

        page = QWizardPage(self)

        self.imgBanner = ImageWidget(self.mainWin.gImgDir, self.mainWin.gIconDir, self)

        # Read in the tips.txt file.
        # fileOpen = open(self.mainWin.gAppDir + os.sep + 'tips.txt')
        # tips = fileOpen.read()
        # fileOpen.close()
        # self.tipsList = [tip for tip in tips.split('\n') if tip] # remove the blank lines also.

        self.tipsList = [tip for tip in TIPS_TXT.split('\n') if tip] # remove the blank lines also.


        # Make sure we don't cause an IndexError.
        # DEV-We might be adding tips to the txt at runtime. The easy way to add and check tips.
        if int(self.mainWin.settings_general_current_tip) >= len(self.tipsList):
            self.mainWin.settings_general_current_tip = 0

        self.labelTipOfTheDay = QLabel(self)
        self.labelTipOfTheDay.setText(self.tipsList[int(self.mainWin.settings_general_current_tip)])
        self.labelTipOfTheDay.setWordWrap(True)

        # Forget about a standardish QCheckBox, real powerusers keep the lights on!
        self.lightswitch = LightSwitchWidget(self.mainWin.gImgDir, self.mainWin, self)

        self.showOnStartupLabel = QLabel(self)
        self.showOnStartupLabel.setText(self.tr('Show tips on startup'))

        layout = QVBoxLayout(self)
        hblayout = QHBoxLayout()
        hblayout2 = QHBoxLayout()
        hblayout.addStretch(1)
        hblayout.addWidget(self.imgBanner)
        hblayout.addStretch(1)
        layout.addLayout(hblayout)
        layout.addStrut(1)
        layout.addSpacerItem(QSpacerItem(0, 5))
        layout.addWidget(self.labelTipOfTheDay)
        layout.addStretch(1)
        hblayout2.addWidget(self.lightswitch)
        hblayout2.addWidget(self.showOnStartupLabel)
        hblayout2.addStretch(1)
        self.showOnStartupLabel.setAlignment(Qt.AlignBottom)

        layout.addLayout(hblayout2)
        page.setLayout(layout)
        self.addPage(page)

        self.setWindowTitle(self.tr('Tip of the Day'))

        buttonPrevious = QPushButton(self)
        buttonPrevious.setText(self.tr('&Previous'))
        buttonPrevious.setIcon(QIcon(self.mainWin.gIconDir + os.sep + 'undo.png'))
        buttonPrevious.setIconSize(QSize(24, 24))
        buttonNext = QPushButton(self)
        buttonNext.setText(self.tr('&Next'))
        buttonNext.setIcon(QIcon(self.mainWin.gIconDir + os.sep + 'redo.png'))
        buttonNext.setIconSize(QSize(24, 24))
        buttonClose = QPushButton(self)
        buttonClose.setText(self.tr('&Close'))
        buttonClose.setIcon(QIcon(self.mainWin.gIconDir + os.sep + 'windowclose.png'))
        buttonClose.setIconSize(QSize(24, 24))

        self.setButton(QWizard.CustomButton1, buttonPrevious)
        self.setButton(QWizard.CustomButton2, buttonNext)
        self.setButton(QWizard.CustomButton3, buttonClose)
        self.setOption(QWizard.HaveCustomButton1, True)
        self.setOption(QWizard.HaveCustomButton2, True)
        self.setOption(QWizard.HaveCustomButton3, True)
        self.customButtonClicked.connect(self.buttonTipOfTheDayClicked)

        listTipOfTheDayButtons = [QWizard.Stretch, QWizard.CustomButton1, QWizard.CustomButton2, QWizard.CustomButton3]
        self.setButtonLayout(listTipOfTheDayButtons)

        self.DoSetWhatsThis()
Esempio n. 25
0
 def _getQIcon(self, icon_file):
     _icon_path = os.path.join(self.app.property("ResPath"), 'icons', icon_file)
     return QIcon(_icon_path)
Esempio n. 26
0
    def SetLayout(self):
        qWidget = QWidget()
        gridLayout = QGridLayout(qWidget)
        row = 0
        self.setCentralWidget(qWidget)

        row += 1
        ssidLabel = QLabel("SSID: ")
        self.ssId = QLineEdit()
        self.ssId.setText("ZodiacWX_24GHz")
        gridLayout.addWidget(ssidLabel, row, 0)
        gridLayout.addWidget(self.ssId, row, 1)

        row += 1
        passwordLabel = QLabel("Password: "******"66666666")
        gridLayout.addWidget(passwordLabel, row, 0)
        gridLayout.addWidget(self.password, row, 1)

        row += 1
        mudServerLabel = QLabel("MUD Server")
        self.mudServerAddress = QLineEdit()
        self.mudServerAddress.setText("203.0.113.7")
        #self.uploadMudUrlCheckbox = QCheckBox()
        #self.uploadMudUrlCheckbox.setToolTip(QToolTip("Send MUD URL to MUD Server?"))
        gridLayout.addWidget(mudServerLabel, row, 0)
        gridLayout.addWidget(self.mudServerAddress, row, 1)

        row += 1
        dppUriLabel = QLabel("DPP URI: ")
        self.dppUri = QLineEdit()
        scanPushButton = QPushButton("Scan", self)
        scanPushButton.clicked.connect(self.doScanQrCode)
        readQrCodePushButton = QPushButton("Select", self)
        readQrCodePushButton.clicked.connect(self.doSelectQrCodeImage)
        gridLayout.addWidget(dppUriLabel, row, 0)
        gridLayout.addWidget(self.dppUri, row, 1)
        gridLayout.addWidget(readQrCodePushButton, row, 2)
        gridLayout.addWidget(scanPushButton, row, 3)

        row += 1
        caCertLabel = QLabel("CA Cert")
        self.caCertPath = QLineEdit()
        self.caCertPath.setText(
            os.environ.get("PROJECT_HOME") +
            "/testcerts/ca/certs/root.cert.pem")
        certPathButton = QPushButton("Select")
        certPathButton.clicked.connect(self.doSelectCaCertPath)
        gridLayout.addWidget(caCertLabel, row, 0)
        gridLayout.addWidget(self.caCertPath, row, 1)
        gridLayout.addWidget(certPathButton, row, 2)

        row += 1
        onboardButton = QPushButton("Onboard Supplicant", self)
        onboardButton.setIcon(QIcon("duck.png"))
        onboardButton.setIconSize(QSize(100, 100))
        onboardButton.clicked.connect(self.doOnboard)

        viewCertButton = QPushButton("View CA Certificate", self)
        viewCertButton.clicked.connect(self.doViewCertificate)

        viewDevCertButton = QPushButton("View Device Certificate", self)
        viewDevCertButton.clicked.connect(self.doViewDeviceCertificate)

        outputCommand = QPushButton("Show Command")
        outputCommand.clicked.connect(self.doViewCommand)

        quitButton = QPushButton("Quit")
        quitButton.clicked.connect(self.doQuit)

        gridLayout.addWidget(onboardButton, row, 0)
        gridLayout.addWidget(viewCertButton, row, 1)
        gridLayout.addWidget(viewDevCertButton, row, 2)
        gridLayout.addWidget(outputCommand, row, 3)
        gridLayout.addWidget(quitButton, row, 4)

        self.myStatusBar = QStatusBar()
        self.setStatusBar(self.myStatusBar)
        self.myStatusBar.showMessage(
            "Note: start wpa_supplicant using start_wpas.sh")
Esempio n. 27
0
    def createWidgets(self):
        self.helpButton = QToolButton()
        self.helpButton.setIcon(QIcon(":/help.svg"))
        self.helpButton.setFocusPolicy(Qt.NoFocus)
        self.tooltips.append((self.helpButton, "Help on the Entry panel."))
        self.addingLabel = Widgets.Label.HtmlLabel(CANCEL_ADD)
        self.addingLabel.hide()
        self.termLabel = QLabel("&Term")
        self.termEdit = Widgets.LineEdit.HtmlLineEdit(self.state)
        self.tooltips.append((self.termEdit, """\
<p><b>Term editor</b> (Alt+T)</p>
<p>The entry's term text styled (e.g., <b>bold</b>, <i>italic</i>), as
it should appear in the final index.</p>"""))
        self.spellHighlighter = Widgets.SpellHighlighter.Highlighter(
            self.state, self.termEdit.document())
        self.termLabel.setBuddy(self.termEdit)
        self.pagesLabel = QLabel("&Pages")
        self.pagesEdit = Widgets.LineEdit.HtmlPagesLineEdit(self.state,
                                                            maxLines=3)
        self.tooltips.append((self.pagesEdit, """\
<p><b>Pages editor</b> (Alt+P)</p>
<p>The entry's pages styled (e.g., <b>bold</b>, <i>italic</i>), as they
should appear in the final index.</p> <p>The pages are automatically
sorted, and exact duplicates are automatically removed.</p> <p>See also
<b>Index→Combine Overlapping Pages</b> and <b>Index→Renumber
Pages</b>.</p>"""))
        self.pagesLabel.setBuddy(self.pagesEdit)
        self.calcSortAsCheckBox = QCheckBox("&Automatically Calculate Sort As")
        self.tooltips.append((self.calcSortAsCheckBox, """\
<p><b>Automatically Calculate Sort As</b> (Alt+A)</p>
<p>This checkbox controls how the Sort As text is created.</p>
<p>If checked, {} will either automatically create the sort as
text, or will present some choices from which to choose the sort as
text, depending on the term text.</p>
<p>If unchecked, the sort as text should be entered
manually.</p>""".format(QApplication.applicationName())))
        self.calcSortAsCheckBox.setChecked(True)
        self.sortAsHelpButton = QToolButton()
        self.sortAsHelpButton.setIcon(QIcon(":/help.svg"))
        self.sortAsHelpButton.setFocusPolicy(Qt.NoFocus)
        self.tooltips.append(
            (self.sortAsHelpButton, "Help on the Sort As text."))
        self.sortAsEdit = Widgets.LineEdit.LineEdit(self.state)
        self.tooltips.append((self.sortAsEdit, """\
<p><b>Sort As editor</b> (Alt+S)</p>
<p>The entry's sort as text.</p>
<p>If the <b>Automatically Calculate Sort As</b> checkbox is unchecked,
manually enter the sort as text to use for sorting the entry.</p>
<p>Main entry's are sorted using the sort as text, so it is easy to
force a non-standard ordering by entering a custom sort as text.</p>
<p>Subentries are also sorted using the sort as text, but the first word
of a subentry will be ignored for sorting purposes if it is in the
Ignore Subentry Function words list (see <b>Index→Ignore Subentry
Function words</b>) <i>and</i> the <b>Index→Options, Rules,
Ignore Subenty Function Words</b> checkbox is checked for this
index.</p>"""))
        self.sortAsEdit.setEnabled(False)
        self.sortAsLabel = QLabel("&Sort As")
        self.sortAsLabel.setBuddy(self.sortAsEdit)
        self.sortAsLabel.setEnabled(False)
        self.xrefLabel = QLabel("&Cross-references")
        self.xrefList = Widgets.List.HtmlListWidget(self.state, minLines=4)
        self.tooltips.append((self.xrefList, """\
<p><b>Cross-references list</b> (Alt+C)</p>
<p>The list of the entry's see and see also cross-references, both
generic and to other entries.</p>
<p>To add a cross-reference to an entry, circle the <i>to</i> entry
(<b>Entry→Circle</b>), then go to the <i>from</i> entry and click
<img src=":/xref-add.svg" width={0} height={0}> or press
<b>Entry→Add Cross-reference</b> (See also the <b>Entry</b>
menu.)</p>""".format(TOOLTIP_IMAGE_SIZE)))
        self.xrefLabel.setBuddy(self.xrefList)
        self.notesLabel = QLabel("&Notes")
        self.notesEdit = Widgets.LineEdit.MultilineHtmlEdit(self.state)
        self.tooltips.append((self.notesEdit, """\
<p><b>Notes editor</b> (Alt+N)</p>
<p>The entry's notes.</p>
<p>The notes shown here are never output as part of
the index so may be freely used for any purpose.</p>
<p>If the notes facility isn't wanted, the notes can be hidden by
unchecking the <b>Index→Options, General, Show Notes</b>
checkbox.</p>"""))
        self.notesLabel.setBuddy(self.notesEdit)
Esempio n. 28
0
    def about(self):
        """Popup a box with about message.
        Input:
            None
        Output:
            None"""
        QMessageBox.about(
            self,
            "About MClub Mover",
            """This program is designed to help make the process of copying \
files from multiple directories much easier and simpler.\n
This software is provided as is with absolutely no warranties.""",
            WindowModility=True)


if __name__ == '__main__':
    ##TODO: Look into setting caching to remember a users preference from previous execution
    if os_version == 'Windows':  # Uberhack to make windows show my icon in the taskbar
        ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(
            'mclub.mover.%s' % __version__)
    app = QApplication(sys.argv)
    splash_img = QPixmap('splash.png')
    splash = QSplashScreen(
        splash_img
    )  # Need to see how to cleanly destroy the splash once the form is loaded.
    splash.show()
    frame = MainWindow()
    frame.show()
    app.setWindowIcon(QIcon('favicon.png'))
    app.exec_()
Esempio n. 29
0
 def __init__(self, data_singleton):
     self.data_singleton = data_singleton
     self._icon = QIcon('plugins/baseinstruments/icons/lastic.png')
Esempio n. 30
0
    def __init__(self, obj=None):
        """Initialize task panel."""
        self.form = Gui.PySideUic.loadUi(TASKPAGE)
        self.tabs = self.form.RenderTabs
        self.tabs.setCurrentIndex(0)
        self.layout = self.tabs.findChild(QFormLayout, "FieldsLayout")
        self.material_type_combo = self.form.findChild(QComboBox,
                                                       "MaterialType")

        # Initialize material name combo
        self.material_combo = self.form.MaterialNameLayout.itemAt(0).widget()
        self.existing_materials = {
            obj.Label: obj
            for obj in App.ActiveDocument.Objects if is_valid_material(obj)
        }
        self.material_combo.addItems(list(self.existing_materials.keys()))
        self.material_combo.currentTextChanged.connect(
            self.on_material_name_changed)

        # Initialize material type combo
        # Note: itemAt(0) is label, itemAt(1) is combo
        self.material_type_combo = self.form.findChild(QComboBox,
                                                       "MaterialType")
        material_type_set = [MaterialSettingsTaskPanel.NONE_MATERIAL_TYPE
                             ] + list(STD_MATERIALS)
        self.material_type_combo.addItems(material_type_set)
        self.material_type_combo.currentTextChanged.connect(
            self.on_material_type_changed)
        self._set_layout_visible("FieldsLayout", False)
        self.fields = []

        # Initialize Father layout
        self._set_layout_visible("FatherLayout", False)
        self.father_field = self.form.FatherLayout.itemAt(1).widget()

        # Initialize Passthru Renderers selector
        rdrwidget = self.form.findChild(QListWidget, "Renderers")
        for rdr in VALID_RENDERERS:
            item = QListWidgetItem()
            item.setText(rdr)
            item.setIcon(QIcon(os.path.join(ICONDIR, f"{rdr}.svg")))
            rdrwidget.addItem(item)
        rdrwidget.setViewMode(QListView.IconMode)
        rdrwidget.setIconSize(QSize(48, 48))
        rdrwidget.setMaximumWidth(96)
        rdrwidget.setSpacing(6)
        rdrwidget.setMovement(QListView.Static)
        rdrwidget.currentTextChanged.connect(
            self.on_passthrough_renderer_changed)
        self.passthru_rdr = rdrwidget
        self.passthru = self.form.findChild(QPlainTextEdit, "PassthroughEdit")
        self.passthru.textChanged.connect(self.on_passthrough_text_changed)
        self.passthru_cache = {}
        self._set_layout_visible("PassthruLayout", False)

        # Get selected material and initialize material type combo with it
        selection = {obj.Label for obj in Gui.Selection.getSelection()}
        selected_materials = selection & self.existing_materials.keys()
        try:
            selected_material = selected_materials.pop()
        except KeyError:
            pass
        else:
            self.material_combo.setCurrentText(selected_material)