python类QIcon()的实例源码

son.py 文件源码 项目:Milis-Yukleyici 作者: sonakinci41 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def __init__(self, ebeveyn=None):
        super(Son, self).__init__(ebeveyn)
        self.e = ebeveyn
        self.kapanacak_mi =False

        kutu = QGridLayout()
        self.setLayout(kutu)

        milis_logo = QLabel()
        milis_logo.setAlignment(Qt.AlignCenter)
        milis_logo.setPixmap(QPixmap("./resimler/milis-logo.svg"))
        kutu.addWidget(milis_logo,0,0,1,2)

        self.veda_label = QLabel()
        self.veda_label.setAlignment(Qt.AlignCenter)
        self.veda_label.setWordWrap(True)
        kutu.addWidget(self.veda_label,1,0,1,2)

        self.denemeye_devam = QRadioButton()
        self.denemeye_devam.setIcon(QIcon("./resimler/cik.svg"))
        self.denemeye_devam.setIconSize(QSize(50,50))
        self.denemeye_devam.toggled.connect(self.degisti)
        kutu.addWidget(self.denemeye_devam,2,0,1,1)
        self.kapat = QRadioButton()
        self.kapat.setIcon(QIcon("./resimler/yeniden-baslat.svg"))
        self.kapat.setIconSize(QSize(50,50))
        self.kapat.toggled.connect(self.degisti)
        kutu.addWidget(self.kapat,2,1,1,1)

        self.denemeye_devam.setChecked(True)
dlg_info.py 文件源码 项目:specton 作者: somesortoferror 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def setupUi(self, FileInfoDialog):
        FileInfoDialog.setObjectName("FileInfoDialog")
        FileInfoDialog.resize(579, 472)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("icons/157-stats-bars.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        FileInfoDialog.setWindowIcon(icon)
        self.gridLayout = QtWidgets.QGridLayout(FileInfoDialog)
        self.gridLayout.setObjectName("gridLayout")
        self.gridLayout_2 = QtWidgets.QGridLayout()
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.tabWidget = QtWidgets.QTabWidget(FileInfoDialog)
        self.tabWidget.setObjectName("tabWidget")
        self.gridLayout_2.addWidget(self.tabWidget, 0, 0, 1, 1)
        self.buttonBox = QtWidgets.QDialogButtonBox(FileInfoDialog)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Close)
        self.buttonBox.setObjectName("buttonBox")
        self.gridLayout_2.addWidget(self.buttonBox, 1, 0, 1, 1)
        self.gridLayout.addLayout(self.gridLayout_2, 0, 0, 1, 1)

        self.retranslateUi(FileInfoDialog)
        self.tabWidget.setCurrentIndex(-1)
        self.buttonBox.accepted.connect(FileInfoDialog.accept)
        self.buttonBox.rejected.connect(FileInfoDialog.reject)
        QtCore.QMetaObject.connectSlotsByName(FileInfoDialog)
inventory.py 文件源码 项目:activity-browser 作者: LCA-ActivityBrowser 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def __init__(self):
        super(ProjectsWidget, self).__init__()
        self.projects_list = ProjectListWidget()
        # Buttons
        self.new_project_button = QtWidgets.QPushButton(QtGui.QIcon(icons.add), 'New')
        self.copy_project_button = QtWidgets.QPushButton(QtGui.QIcon(icons.copy), 'Copy current')
        self.delete_project_button = QtWidgets.QPushButton(QtGui.QIcon(icons.delete), 'Delete current')
        # Layout
        self.h_layout = QtWidgets.QHBoxLayout()
        self.h_layout.addWidget(header('Current Project:'))
        self.h_layout.addWidget(self.projects_list)
        self.h_layout.addWidget(self.new_project_button)
        self.h_layout.addWidget(self.copy_project_button)
        self.h_layout.addWidget(self.delete_project_button)
        self.setLayout(self.h_layout)
        self.setSizePolicy(QtWidgets.QSizePolicy(
            QtWidgets.QSizePolicy.Maximum,
            QtWidgets.QSizePolicy.Maximum)
        )
        self.connect_signals()
menu_bar.py 文件源码 项目:activity-browser 作者: LCA-ActivityBrowser 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def setup_help_menu(self):
        bug_icon = QtGui.QIcon(icons.debug)
        help_menu = QtWidgets.QMenu('&Help', self.window)
        help_menu.addAction(
            self.window.icon,
            '&About Activity Browser',
            self.about)

        help_menu.addAction(
            '&About Qt',
            lambda: QtWidgets.QMessageBox.aboutQt(self.window)
        )
        help_menu.addAction(
            bug_icon,
            '&Report Bug on github',
            self.raise_issue_github
        )
        help_menu.addAction(
            bug_icon,
            '&Report Bug',
            self.raise_issue_from_app
        )
        return help_menu
main_ui_progress.py 文件源码 项目:EMFT 作者: 132nd-etcher 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def progress_start(title: str = '', length: int = 100, label: str = ''):
        MainUiProgress.progress = QProgressDialog()
        MainUiProgress.progress.setWindowFlags(Qt.FramelessWindowHint)
        MainUiProgress.progress.setWindowFlags(Qt.WindowTitleHint)
        MainUiProgress.progress.setMinimumWidth(400)
        from PyQt5.QtWidgets import QPushButton
        # QString() seems to be deprecated in v5
        # PyQt does not support setCancelButton(0) as it expects a QPushButton instance
        # Get your shit together, Qt !
        MainUiProgress.progress.findChild(QPushButton).hide()
        MainUiProgress.progress.setMinimumDuration(1)
        MainUiProgress.progress.setWindowModality(Qt.ApplicationModal)
        MainUiProgress.progress.setCancelButtonText('')
        MainUiProgress.progress.setWindowIcon(QIcon(':/ico/app.ico'))
        MainUiProgress.progress.setWindowTitle(title)
        MainUiProgress.progress.setLabelText(label)
        MainUiProgress.progress.setMaximum(length)
        MainUiProgress.progress.show()
app.py 文件源码 项目:launcher 作者: getavalon 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def __init__(self, root, source):
        super(Application, self).__init__(sys.argv)
        self.setWindowIcon(QtGui.QIcon(ICON_PATH))

        engine = QtQml.QQmlApplicationEngine()
        engine.objectCreated.connect(self.on_object_created)
        engine.warnings.connect(self.on_warnings)
        engine.addImportPath(QML_IMPORT_DIR)

        try:
            io.install()
        except IOError:
            raise  # Server refused to connect

        terminal.init()

        controller = control.Controller(root, self)
        engine.rootContext().setContextProperty("controller", controller)
        engine.rootContext().setContextProperty("terminal", terminal.model)

        self.engine = engine
        self.controller = controller

        engine.load(QtCore.QUrl.fromLocalFile(source))
dolphinapp.py 文件源码 项目:Dolphin-Updater 作者: nbear3 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def __init__(self, user_data_control):
        super().__init__()
        sys.excepthook = self._displayError
        self._udc = user_data_control

        self.check = QPixmap("res/check.png")
        self.cancel = QPixmap("res/cancel.png")

        self.setGeometry(500, 500, 500, 465)
        self.init_ui()
        self.init_window()
        self.init_user_data()

        self.setWindowTitle(self.APP_TITLE)
        self.setWindowIcon(QIcon('res/rabbit.png'))
        center(self)
        self.show()

    # PyQt Error Handling
OpenDialog.py 文件源码 项目:kodi-remote 作者: chatper 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, addons, parent):
        super().__init__()

        self.setGeometry(300, 300, 300, 300)
        self.setWindowTitle('Open Addon')
        self.setWindowIcon(QIcon(ICON_PATH))

        label = QLabel('Choose the addon you want to open.')

        grid = QGridLayout()
        grid.setSpacing(4)

        grid.addWidget(label, 0, 0)

        self.addonList = addons.split('-')
        self.addonList.remove('')
        self.parent = parent

        for i,j in enumerate(self.addonList):
            l = QLabel(str(i)+' -> '+j)
            grid.addWidget(l, i+1, 0)

        self.setLayout(grid)
        self.show()
OnCue.py 文件源码 项目:OnCue 作者: featherbear 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __init__(self):
            """
            Set up the interface
            """
            super(Application, self).__init__()
            global selector
            self.setWindowTitle("OnCue")
            self.setWindowIcon(QtGui.QIcon("OnCue.ico"))
            self.resize(900, 900)
            self.setMinimumSize(self.size())
            self.setMaximumSize(self.size())
            self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
            selector = QtWidgets.QStackedWidget()
            self.setCentralWidget(selector)
            states["interface"]["ui"] = [MAIN(), PREFERENCES()]
            [selector.addWidget(ui) for ui in states["interface"]["ui"]]
__init__.py 文件源码 项目:StarCraft-Casting-Tool 作者: teampheenix 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def main_window(app, translator, cntlr=None):
    """Run the main exectuable."""
    from PyQt5.QtCore import QSize
    from PyQt5.QtGui import QIcon
    from scctool.controller import MainController
    from scctool.view.main import MainWindow

    try:
        """Run the main program."""
        icon = QIcon()
        icon.addFile(getAbsPath('src/scct.ico'), QSize(32, 32))
        icon.addFile(getAbsPath('src/scct.png'), QSize(256, 256))
        app.setWindowIcon(icon)
        if cntlr is None:
            cntlr = MainController()
        MainWindow(cntlr, app, translator)
        logger.info("Starting...")
        return cntlr

    except Exception as e:
        logger.exception("message")
        raise
simulation_gui.py 文件源码 项目:pymoskito 作者: cklb 项目源码 文件源码 阅读 69 收藏 0 点赞 0 评论 0
def regime_batch_finished(self, status):
        self.runningBatch = False
        self.actSimulateAll.setDisabled(False)
        self.actSave.setDisabled(True)

        self.actSimulateAll.setText("Simulate &All Regimes")
        self.actSimulateAll.setIcon(QIcon(get_resource("execute_regimes.png")))
        self.actSimulateAll.triggered.disconnect(self.stop_regime_excecution)
        self.actSimulateAll.triggered.connect(self.start_regime_execution)

        if status:
            self.statusLabel.setText("All regimes have been simulated")
            self._logger.info("All Regimes have been simulated")
        else:
            self._logger.error("Batch simulation has been aborted")

        if self._settings.value("control/exit_on_batch_completion") == "True":
            self._logger.info("Shutting down SimulationGUI")
            self.close()
workerhandler.py 文件源码 项目:pyree-old 作者: DrLuke 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __init__(self, parent):
        self.parent = parent

        self.workerAccepted = False     # Whether or not the worker accepted the controller
        self.workerTreeItem = QTreeWidgetItem()

        self.monitorState = {}

        self.inbuf = ""
        self.connection = None

        self.requestJar = {}

        # Refresh monitors every 5 seconds
        self.monitorTimer = QTimer()
        self.monitorTimer.timeout.connect(self.requestMonitors)
        self.monitorTimer.start(5000)

        #
        self.errorIcon = QIcon("resources/icons/exclamation.png")
workerhandler.py 文件源码 项目:pyree-old 作者: DrLuke 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def itemClicked(self, treeItem, columnIndex):
        self.sheethandler.itemClickedWorker(treeItem, columnIndex)
        self.lastItemClicked = treeItem

        monitorFound = False
        for key in self.connections:
            for monitor in self.connections[key][1].monitorState:
                if treeItem == self.connections[key][1].monitorState[monitor]["treeitem"]:
                    self.currentMonitor = monitor
                    self.currentWorker = self.connections[key][1]
                    monitorFound = True
                    self.updateMonitorControls(self.connections[key][1].monitorState[monitor]["state"])

        if not monitorFound:
            self.workerDockWidget.startRepeatButton.setEnabled(False)
            self.workerDockWidget.startRepeatButton.setIcon(QIcon("resources/icons/control_play.png"))
            self.workerDockWidget.stopButton.setEnabled(False)
dl_gui.py 文件源码 项目:Yugioh-bot 作者: will7200 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def createIconGroupBox(self):
        self.iconGroupBox = QGroupBox("Tray Icon")

        self.iconLabel = QLabel("Icon:")

        self.iconComboBox = QComboBox()
        self.iconComboBox.addItem(QIcon('assets/yugioh.ico'), "Duel-Card")

        self.showIconCheckBox = QCheckBox("Show icon")
        self.showIconCheckBox.setChecked(True)

        iconLayout = QHBoxLayout()
        iconLayout.addWidget(self.iconLabel)
        iconLayout.addWidget(self.iconComboBox)
        iconLayout.addStretch()
        iconLayout.addWidget(self.showIconCheckBox)
        self.iconGroupBox.setLayout(iconLayout)
menu.py 文件源码 项目:VIRTUAL-PHONE 作者: SumanKanrar-IEM 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def initUI(self):
        self.setWindowTitle(self.title)
        self.setGeometry(self.left, self.top, self.width, self.height)

        mainMenu = self.menuBar() 
        fileMenu = mainMenu.addMenu('File')
        editMenu = mainMenu.addMenu('Edit')
        viewMenu = mainMenu.addMenu('View')
        searchMenu = mainMenu.addMenu('Search')
        toolsMenu = mainMenu.addMenu('Tools')
        helpMenu = mainMenu.addMenu('Help')

        exitButton = QAction(QIcon('exit24.png'), 'Exit', self)
        exitButton.setShortcut('Ctrl+Q')
        exitButton.setStatusTip('Exit application')
        exitButton.triggered.connect(self.close)
        fileMenu.addAction(exitButton)

        self.show()
Notepad.py 文件源码 项目:VIRTUAL-PHONE 作者: SumanKanrar-IEM 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def init_ui(self):
        v_layout = QVBoxLayout()
        h_layout = QHBoxLayout()

        h_layout.addWidget(self.clr_btn)
        h_layout.addWidget(self.sav_btn)
        h_layout.addWidget(self.opn_btn)

        v_layout.addWidget(self.text)
        v_layout.addLayout(h_layout)

        self.sav_btn.clicked.connect(self.save_text)
        self.clr_btn.clicked.connect(self.clear_text)
        self.opn_btn.clicked.connect(self.open_text)

        self.setLayout(v_layout)
        #self.setWindowTitle("notepad")
        #self.setWindowIcon(QIcon('notepad.png'))



        self.show()
calculator_ui.py 文件源码 项目:VIRTUAL-PHONE 作者: SumanKanrar-IEM 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "Calculator"))
        MainWindow.setWindowIcon(QtGui.QIcon('calculator.png'))
        self.btn_clear.setText(_translate("MainWindow", "C"))
        self.btn_allclear.setText(_translate("MainWindow", "AC"))
        self.btn_8.setText(_translate("MainWindow", "8"))
        self.btn_add.setText(_translate("MainWindow", "+"))
        self.btn_2.setText(_translate("MainWindow", "2"))
        self.btn_multiply.setText(_translate("MainWindow", "*"))
        self.btn_decimal.setText(_translate("MainWindow", "."))
        self.btn_equals.setText(_translate("MainWindow", "="))
        self.btn_9.setText(_translate("MainWindow", "9"))
        self.btn_divide.setText(_translate("MainWindow", "/"))
        self.btn_7.setText(_translate("MainWindow", "7"))
        self.btn_4.setText(_translate("MainWindow", "4"))
        self.btn_5.setText(_translate("MainWindow", "5"))
        self.btn_sub.setText(_translate("MainWindow", "-"))
        self.btn_3.setText(_translate("MainWindow", "3"))
        self.btn_0.setText(_translate("MainWindow", "0"))
        self.btn_6.setText(_translate("MainWindow", "6"))
        self.btn_1.setText(_translate("MainWindow", "1"))
Notepad.py 文件源码 项目:VIRTUAL-PHONE 作者: SumanKanrar-IEM 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def init_ui(self):
        v_layout = QVBoxLayout()
        h_layout = QHBoxLayout()

        h_layout.addWidget(self.clr_btn)
        h_layout.addWidget(self.sav_btn)
        h_layout.addWidget(self.opn_btn)

        v_layout.addWidget(self.text)
        v_layout.addLayout(h_layout)

        self.sav_btn.clicked.connect(self.save_text)
        self.clr_btn.clicked.connect(self.clear_text)
        self.opn_btn.clicked.connect(self.open_text)

        self.setLayout(v_layout)
        #self.setWindowTitle("notepad")
        #self.setWindowIcon(QIcon('notepad.png'))



        self.show()
{{cookiecutter.application_name}}.py 文件源码 项目:cookiecutter-pyqt5 作者: mandeep 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def __init__(self, parent=None):
        """Display a dialog that shows application information."""
        super(AboutDialog, self).__init__(parent)

        self.setWindowTitle('About')
        help_icon = pkg_resources.resource_filename('{{ cookiecutter.package_name }}.images',
                                                    'ic_help_black_48dp_1x.png')
        self.setWindowIcon(QIcon(help_icon))
        self.resize(300, 200)

        author = QLabel('{{ cookiecutter.full_name }}')
        author.setAlignment(Qt.AlignCenter)

        icons = QLabel('Material design icons created by Google')
        icons.setAlignment(Qt.AlignCenter)

        github = QLabel('GitHub: {{ cookiecutter.github_username }}')
        github.setAlignment(Qt.AlignCenter)

        self.layout = QVBoxLayout()
        self.layout.setAlignment(Qt.AlignVCenter)

        self.layout.addWidget(author)
        self.layout.addWidget(icons)
        self.layout.addWidget(github)

        self.setLayout(self.layout)
window.py 文件源码 项目:whither 作者: Antergos 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def _init_menu_bar(self) -> None:
        exit_action = QAction(QIcon('exit.png'), '&Exit', self)
        exit_action.setShortcut('Ctrl+Q')
        exit_action.setStatusTip('Exit application')
        exit_action.triggered.connect(qApp.quit)

        menu_bar = self.widget.menuBar()

        file_menu = menu_bar.addMenu('&File')
        file_menu.addAction(exit_action)

        edit_menu = menu_bar.addMenu('&Edit')
        edit_menu.addAction(exit_action)

        view_menu = menu_bar.addMenu('&View')
        view_menu.addAction(exit_action)

        about_menu = menu_bar.addMenu('&About')
        about_menu.addAction(exit_action)
shims.py 文件源码 项目:lighthouse 作者: gaasedelen 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def __init__(self, title, icon_path):
        self._title = title
        self._icon = QtGui.QIcon(icon_path)

        # IDA 7+ Widgets
        if using_ida7api:
            import sip

            self._form   = idaapi.create_empty_widget(self._title)
            self._widget = sip.wrapinstance(long(self._form), QtWidgets.QWidget) # NOTE: LOL

        # legacy IDA PluginForm's
        else:
            self._form = idaapi.create_tform(self._title, None)
            if using_pyqt5:
                self._widget = idaapi.PluginForm.FormToPyQtWidget(self._form)
            else:
                self._widget = idaapi.PluginForm.FormToPySideWidget(self._form)

        self._widget.setWindowIcon(self._icon)
traywidget.py 文件源码 项目:kawaii-player 作者: kanishka-linux 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self, parent=None, ui_widget=None, home=None, window=None, logr=None):
        global ui, MainWindow, logger
        QtWidgets.QSystemTrayIcon.__init__(self, parent)
        ui = parent
        MainWindow = window
        logger = logr
        icon_img = os.path.join(home, 'src', 'tray.png')
        self.right_menu = RightClickMenuIndicator(ui_widget=ui_widget,
                                                  window=window, logr=logr)
        self.setContextMenu(self.right_menu)

        self.activated.connect(self.onTrayIconActivated)
        self.p = QtGui.QPixmap(24, 24)
        self.p.fill(QtGui.QColor("transparent"))
        painter = QtGui.QPainter(self.p)
        if os.path.exists(icon_img):
            self.setIcon(QtGui.QIcon(icon_img))
        else:
            self.setIcon(QtGui.QIcon(""))
        self.full_scr = 1
        del painter
kawaii_player.py 文件源码 项目:kawaii-player 作者: kanishka-linux 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def thumbnail_generated(self, row=None, picn=None):
        try:
            if os.path.exists(picn):
                if not os.stat(picn).st_size:
                    picn = self.default_background
            if self.list_with_thumbnail:
                icon_new_pixel = self.create_new_image_pixel(picn, 128)
                if os.path.exists(icon_new_pixel):
                    try:
                        if row < self.list2.count():
                            self.list2.item(row).setIcon(QtGui.QIcon(icon_new_pixel))
                    except Exception as err:
                        print(err, '--6238--')
        except Exception as err:
            print(err, '--6240--')
        print("Thumbnail Process Ended")
        self.threadPoolthumb = self.threadPoolthumb[1:]
        length = len(self.threadPoolthumb)
        if length > 0:
            if not self.threadPoolthumb[0].isRunning():
                self.threadPoolthumb[0].start()
KeyboardKey.py 文件源码 项目:pyqt5 作者: yurisnm 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def set_up_button(self, style, str_icon_on, str_icon_off, auto_repeat,
                      size, receiver, key, str_key):
        self.__size = size
        self.__style = style
        self.__icon_on = str_icon_on
        self.__icon_off = str_icon_off
        self.__auto_repeat = auto_repeat
        self.__receiver = receiver
        self.__key = key
        self.__str_key = str_key
        if str_key not in ['KB', 'A?', '?', '?', 'backspace']:
            self.setText(str_key)

        self.setFixedSize(size[0], size[1])
        self.setStyleSheet(style)
        self.setIconSize(QSize(size[0], size[1]))
        self.setIcon(QIcon(self.__path + str_icon_off + ".png"))
        self.setAutoRepeat(auto_repeat)
        # pix_map = QPixmap(self.__path + str_icon_off + ".png")
        # self.setMask(pix_map.mask())
        self.pressed.connect(self.key_pressed)
        self.released.connect(self.key_released)
start_chess_dialog.py 文件源码 项目:pysport 作者: sportorg 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def init_ui(self):
        self.setWindowTitle(_('Start times'))
        self.setWindowIcon(QIcon(config.ICON))
        self.setSizeGripEnabled(False)
        self.setModal(True)

        self.layout = QFormLayout(self)

        self.text = QTextEdit()
        self.text.setMinimumHeight(450)
        self.text.setMinimumWidth(450)
        self.text.setMaximumHeight(450)
        self.layout.addRow(self.text)

        self.set_text()

        def cancel_changes():
            self.close()

        def apply_changes():
            try:
                self.apply_changes_impl()
            except Exception as e:
                logging.exception(str(e))
            self.close()

        self.button_ok = QPushButton(_('Save to file'))
        self.button_ok.clicked.connect(apply_changes)
        self.button_cancel = QPushButton(_('Cancel'))
        self.button_cancel.clicked.connect(cancel_changes)
        self.layout.addRow(self.button_ok, self.button_cancel)

        self.show()
main.py 文件源码 项目:pysport 作者: sportorg 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def _setup_ui(self):
        geometry = ConfigFile.GEOMETRY
        x = Configuration().parser.getint(geometry, 'x', fallback=480)
        y = Configuration().parser.getint(geometry, 'y', fallback=320)
        width = Configuration().parser.getint(geometry, 'width', fallback=880)
        height = Configuration().parser.getint(geometry, 'height', fallback=474)

        self.setMinimumSize(QtCore.QSize(480, 320))
        self.setGeometry(x, y, 480, 320)
        self.setWindowIcon(QtGui.QIcon(config.ICON))
        self.set_title()
        self.resize(width, height)
        self.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.setDockNestingEnabled(False)
        self.setDockOptions(QtWidgets.QMainWindow.AllowTabbedDocks
                            | QtWidgets.QMainWindow.AnimatedDocks
                            | QtWidgets.QMainWindow.ForceTabbedDocks)
main.py 文件源码 项目:pysport 作者: sportorg 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def _create_menu(self, parent, actions_list):
        for action_item in actions_list:
            if 'type' in action_item:
                if action_item['type'] == 'separator':
                    parent.addSeparator()
            elif 'action' in action_item:
                action = QtWidgets.QAction(self)
                parent.addAction(action)
                action.setText(action_item['title'])
                action.triggered.connect(action_item['action'])
                if 'shortcut' in action_item:
                    action.setShortcut(action_item['shortcut'])
                if 'icon' in action_item:
                    action.setIcon(QtGui.QIcon(action_item['icon']))
                if 'status_tip' in action_item:
                    action.setStatusTip(action_item['status_tip'])
                if 'property' in action_item:
                    self.menu_property[action_item['property']] = action
            else:
                menu = QtWidgets.QMenu(parent)
                menu.setTitle(action_item['title'])
                self._create_menu(menu, action_item['actions'])
                parent.addAction(menu.menuAction())
UdpClient.py 文件源码 项目:udpsocket-gobang 作者: gzdaijie 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def createMenu(self):
        def quitGame():
            #???????
            reply = QMessageBox.question(self,'??','?????',QMessageBox.Yes,QMessageBox.No)
            if reply == QMessageBox.Yes:
                qApp.quit()

        def aboutUs():
            QMessageBox.about(self,'????',str(self))

        menubar = self.menuBar()
        #???
        main_menu = menubar.addMenu('&???')
        main_menu.addAction(QAction(QIcon('images/icon.jpg'),'??',
                                 self, statusTip="???????", triggered=quitGame))
        #????
        about_menu = menubar.addMenu('&??')
        about_menu.addAction(QAction(QIcon('images/icon.jpg'),'??',
                                 self, statusTip="????", triggered=aboutUs))
uamodeler.py 文件源码 项目:opcua-modeler 作者: FreeOpcUa 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def _fix_icons(self):
        # fix icon stuff
        self.ui.actionNew.setIcon(QIcon(":/new.svg"))
        self.ui.actionOpen.setIcon(QIcon(":/open.svg"))
        self.ui.actionCopy.setIcon(QIcon(":/copy.svg"))
        self.ui.actionPaste.setIcon(QIcon(":/paste.svg"))
        self.ui.actionDelete.setIcon(QIcon(":/delete.svg"))
        self.ui.actionSave.setIcon(QIcon(":/save.svg"))
        self.ui.actionAddFolder.setIcon(QIcon(":/folder.svg"))
        self.ui.actionAddObject.setIcon(QIcon(":/object.svg"))
        self.ui.actionAddMethod.setIcon(QIcon(":/method.svg"))
        self.ui.actionAddObjectType.setIcon(QIcon(":/object_type.svg"))
        self.ui.actionAddProperty.setIcon(QIcon(":/property.svg"))
        self.ui.actionAddVariable.setIcon(QIcon(":/variable.svg"))
        self.ui.actionAddVariableType.setIcon(QIcon(":/variable_type.svg"))
        self.ui.actionAddDataType.setIcon(QIcon(":/data_type.svg"))
        self.ui.actionAddReferenceType.setIcon(QIcon(":/reference_type.svg"))
mplCanvas.py 文件源码 项目:Py2DSpectroscopy 作者: SvenBo90 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __init__(self, parent, current_colormap):

        # call widget init
        QDialog.__init__(self, parent)

        # define available colormaps
        colormaps = ['bwr', 'gnuplot', 'gnuplot2', 'inferno', 'nipy_spectral', 'seismic', 'viridis']

        # load and set up UI
        self.ui = UiColormapDialog(self)

        # fill combobox with colormaps
        current_id = 0
        for i_colormap in range(len(colormaps)):
            if colormaps[i_colormap] == current_colormap:
                current_id = i_colormap
            self.ui.colormap_combobox.addItem(QIcon('./img/cm_'+colormaps[i_colormap]+'.png'), colormaps[i_colormap])
        self.ui.colormap_combobox.setCurrentIndex(current_id)


问题


面经


文章

微信
公众号

扫码关注公众号