python类QMainWindow()的实例源码

universal_tool_template_0904.py 文件源码 项目:universal_tool_template.py 作者: shiningdesign 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def setupWin(self):
        super(self.__class__,self).setupWin()
        self.setGeometry(500, 300, 250, 110) # self.resize(250,250)

        #------------------------------
        # template list: for frameless or always on top option
        #------------------------------
        # - template : keep ui always on top of all;
        # While in Maya, dont set Maya as its parent
        '''
        self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) 
        '''

        # - template: hide ui border frame; 
        # While in Maya, use QDialog instead, as QMainWindow will make it disappear
        '''
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
        '''

        # - template: best solution for Maya QDialog without parent, for always on-Top frameless ui
        '''
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint)
        '''

        # - template: for transparent and non-regular shape ui
        # note: use it if you set main ui to transparent, and want to use alpha png as irregular shape window
        # note: black color better than white for better look of semi trans edge, like pre-mutiply
        '''
        self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
        self.setStyleSheet("background-color: rgba(0, 0, 0,0);")
        '''
gui.py 文件源码 项目:dottorrent-gui 作者: kz26 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def main():
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QMainWindow()
    ui = DottorrentGUI()
    ui.setupUi(MainWindow)

    MainWindow.resize(500, 0)
    MainWindow.setGeometry(
        QtWidgets.QStyle.alignedRect(
            QtCore.Qt.LeftToRight,
            QtCore.Qt.AlignCenter,
            MainWindow.size(),
            app.desktop().availableGeometry()
        )  
    )
    MainWindow.setWindowTitle(PROGRAM_NAME_VERSION)

    ui.loadSettings()
    ui.clipboard = app.clipboard
    app.aboutToQuit.connect(lambda: ui.saveSettings())
    MainWindow.show()
    sys.exit(app.exec_())
main.py 文件源码 项目:master-calculator 作者: hesamkaveh 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self):
        QtWidgets.QMainWindow.__init__(self)
        Ui_MainWindow.__init__(self)
        self.setupUi(self)
        self.limit_button.clicked.connect(self.limittfunc)
        self.diffButton_normal.clicked.connect(self.diff_normal)
        self.diffButton_complex.clicked.connect(self.diff_complex)
        self.integralButton_normal.clicked.connect(self.integral_normal)
        self.integralButton_complex.clicked.connect(self.integral_complex)
        self.allCalculator.clicked.connect(self.allcalc)
        self.binomialButton.clicked.connect(self.binomialfunc)
        self.solver_button.clicked.connect(self.solver)
        self.sumButton.clicked.connect(self.sumfunc)
        self.factorButton.clicked.connect(self.factorfunc)
        self.fourierButton.clicked.connect(self.fourier)
        self.integralButton_copy.clicked.connect(self.copy)
        self.integralButton_copy_3.clicked.connect(self.copy)
        self.integralButton_copy_9.clicked.connect(self.copy)
        self.integralButton_copy_10.clicked.connect(self.copy)
        self.integralButton_copy_11.clicked.connect(self.copy)
        self.integralButton_copy_12.clicked.connect(self.copy)
        self.integralButton_copy_13.clicked.connect(self.copy)
        self.integralButton_copy_2.clicked.connect(self.copy)
        self.integralButton_copy_4.clicked.connect(self.copy)
dashboard.py 文件源码 项目:face 作者: MOluwole 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self):
        QtWidgets.QMainWindow.__init__(self)
        Ui_MainWindow.__init__(self)
        self.setupUi(self)

        self.__register__ = None
        self.__attendance____ = None

        self.btn_Register.clicked.connect(self.Register)
        self.btn_Attendance.clicked.connect(self.Attendance)
        self.btnSearch.clicked.connect(self.Search)
        self.report_date.setDate(QtCore.QDate.currentDate())

        cursor = connection.cursor()
        sql = "Select * from attendance"
        cursor.execute(sql)

        result = cursor.fetchall()
        rows = len(result)
        if rows <= 0:
            QMessageBox.about(self, "No Data", "No Attendance has been recorded yet")
        else:
            self.tableWidget.setRowCount(rows)
            self.tableWidget.setColumnCount(3)
            header_labels = ['Matric Number', 'Date', 'Status']
            self.tableWidget.setHorizontalHeaderLabels(header_labels)

            for count in range(0, rows):
                self.tableWidget.setItem(count, 0,
                                         QTableWidgetItem(str(result[count]["matric_num"].encode('ascii', 'ignore'))))
                self.tableWidget.setItem(count, 1, QTableWidgetItem(result[count]["dte"].encode('ascii', 'ignore')))
                self.tableWidget.setItem(count, 2, QTableWidgetItem(result[count]["status"].encode('ascii', 'ignore')))
runnix.py 文件源码 项目:runnix 作者: TheInitializer 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __init__(self):
        QtWidgets.QMainWindow.__init__(self)

        self.ui = uic.loadUi(l('cmd.ui'), self)
        self.ui.show()

        self.plainTextEdit.appendPlainText("Microsoft Windows (Version 10.0.10240)")
        self.plainTextEdit.appendPlainText("(c) 2015 Microsoft Corporation. All rights reserved. \n")

        self.plainTextEdit.appendPlainText("C:\\> ")

        self.plainTextEdit.installEventFilter(self)

        self.editable = True
        self.keys = []
        self.lolnope = []
prototype.py 文件源码 项目:SiebenApp 作者: ahitrin 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def main():
    app = QApplication(sys.argv)
    w = QMainWindow()
    central_widget = CentralWidget()
    my_widgets = [
        (GoalWidget('one', '5'), 1, 1),
        (GoalWidget('two', '2'), 1, 2),
        (GoalWidget('An example of goal\nwith a long name', '3'), 2, 2),
        (GoalWidget('four', '1'), 2, 3),
        (GoalWidget('five', '4'), 3, 2),
    ]
    my_lines = [
        (0, 2), (1, 2),
        (2, 4), (3, 4),
    ]
    for widget, row, column in my_widgets:
        central_widget.addCustomWidget(widget, row, column)
    for upper, lower in my_lines:
        central_widget.addCustomLine(upper, lower)
    w.setCentralWidget(central_widget)
    w.show()
    sys.exit(app.exec_())
main.py 文件源码 项目:pysport 作者: sportorg 项目源码 文件源码 阅读 21 收藏 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)
videoframes.py 文件源码 项目:desktop-stream-viewer 作者: AbiosGaming 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def rewind(self):
        if not cfg[CONFIG_BUFFER_STREAM]:
            QtWidgets.QMessageBox().warning(
                self,
                "Warning",
                "Cannot Rewind. You currently have buffering turned off."
            )
            return
        if self.rewound is None:
            self.rewound = QtWidgets.QMainWindow(parent=self)
            self.rewound.setWindowTitle("Rewound Stream")
            self.rewound.resize(QtWidgets.QDesktopWidget().availableGeometry(-1).size() * 0.5)
            self.rewound.frame = RewoundVideoFrame(self.rewound, self.stream.buffer)
            # Set events:
            self.rewound.closeEvent = self.close_rewound
            self.rewound.frame._fullscreen = self.fullscreen_rewound

            self.rewound.setCentralWidget(self.rewound.frame)
            self.rewound.show()
            # Init values
            self.rewound.is_fullscreen = False

    # Following functions belong to the rewound window
universal_tool_template_1020.py 文件源码 项目:universal_tool_template.py 作者: shiningdesign 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def qui_menubar(self, menu_list_str):
        if not isinstance(self, QtWidgets.QMainWindow):
            print("Warning: Only QMainWindow can have menu bar.")
            return
        menubar = self.menuBar()
        create_opt_list = [ x.strip() for x in menu_list_str.split('|') ]
        for each_creation in create_opt_list:
            ui_info = [ x.strip() for x in each_creation.split(';') ]
            menu_name = ui_info[0]
            menu_title = ''
            if len(ui_info) > 1:
                menu_title = ui_info[1]
            if menu_name not in self.uiList.keys():
                self.uiList[menu_name] = QtWidgets.QMenu(menu_title)
            menubar.addMenu(self.uiList[menu_name])
    # compatible hold function
gui.py 文件源码 项目:solar-sails 作者: metrasynth 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def main(*filenames: 'Files to open immediately'):
    """Start the Solar Sails GUI."""
    app = App(sys.argv)
    midi.load()
    midi.listener.update_ports()
    midi.listener.start_port_listener('Metrasynth Solar Sails', virtual=True)
    app.aboutToQuit.connect(midi.listener.stop)
    loop = QEventLoop(app)
    asyncio.set_event_loop(loop)
    main_window = QMainWindow()
    main_window.setMenuBar(MainMenuBar())
    welcome_widget = WelcomeWidget(main_window)
    main_window.setCentralWidget(welcome_widget)
    main_window.show()
    for filename in filenames:
        window = Opener.open_file(filename)
        if window:
            window.show()
            window.setFocus(True)
    loop.run_forever()
MainWindow.py 文件源码 项目:PySAT_Point_Spectra_GUI 作者: USGS-Astrogeology 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def _readAndApplyWindowAttributeSettings(self):
        '''
        Read window attributes from settings,
        using current attributes as defaults (if settings not exist.)

        Called at QMainWindow initialization, before show().
        '''
        self.settings.beginGroup("mainWindow")
        # No need for toPoint, etc. : PySide converts types
        try:
            self.MainWindow.move(self.settings.value("pos"))
            if self.settings.value("maximized") in 'true':
                self.MainWindow.showMaximized()
            else:
                self.MainWindow.resize(self.settings.value("size"))
        except:
            pass
        self.settings.endGroup()
pyQt5_GUI.py 文件源码 项目:Bitpy 作者: Shultzi 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__(self):
        self.receivingQueue = Utils.globals.receivingQueue
        self.sendingQueue = Utils.globals.sendingQueue

        self.app = QtWidgets.QApplication(sys.argv)
        self.MainWindow = QtWidgets.QMainWindow()
        self.ui = Ui_MainWindow()
        self.stack = Stack()


        # Start UI
        self.ui.setupUi(self.MainWindow)

        # Init components
        self.init_components()

        UI_updater(self.ui).start()

        # CLose UI
        self.MainWindow.show()
        sys.exit(self.app.exec_())

    # define the actions when event triggered by the UI
fygui.py 文件源码 项目:dayworkspace 作者: copie 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self):
        self.app = QApplication(sys.argv)
        self.mainWindow = QMainWindow()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self.mainWindow)

        self.Dialog = QtWidgets.QDialog()
        self.ui2 = Ui_Form()
        self.ui2.setupUi(self.Dialog)

        self.ui.textEdit.setReadOnly(True)
        self.clipboard = QApplication.clipboard()
        self.clipboard.selectionChanged.connect(self.fanyi)
        self.mainWindow.setWindowTitle("????")
        self.mainWindow.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
        self.ui2.lineEdit.editingFinished.connect(self.callInput)
        self.Dialog.moveEvent = self.mainMove
        self.wordutil = wordutil()
        self.time = time.time()
        self.ui.textEdit.mouseDoubleClickEvent = self.inputText
__init__.py 文件源码 项目:binja_dynamics 作者: nccgroup 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def init_gui():
    """ Tries to find the main Binja window. If we've already found it, does nothing.
    Call this as many times as you want, just in case. """
    global main_window
    if main_window is None:
        app = QApplication.instance()
        main_window = [x for x in app.allWidgets() if x.__class__ is QMainWindow][0]
login.py 文件源码 项目:face 作者: MOluwole 项目源码 文件源码 阅读 40 收藏 0 点赞 0 评论 0
def __init__(self):
        QtWidgets.QMainWindow.__init__(self)
        Ui_MainWindow.__init__(self)
        self.__dashboard__ = None
        self.setupUi(self)

        self.btn_exit.clicked.connect(self.Exit)
        self.btn_login.clicked.connect(self.Login)
register.py 文件源码 项目:face 作者: MOluwole 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def __init__(self):
        QtWidgets.QMainWindow.__init__(self)
        self.__get_face__ = None
        Ui_MainWindow.__init__(self)
        self.setupUi(self)
        self.btn_train_classifier.clicked.connect(self.classifier)
        self.dte_dob.setDate(QtCore.QDate.currentDate())
reorderable_list_model.py 文件源码 项目:PyQt5-reorderable-list-model 作者: d1vanov 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __init__(self, parent=None):
        QtWidgets.QMainWindow.__init__(self, parent)
        self.model = ReorderableListModel()
        self.selectionModel = SelectionModel(self.model)
        self.model.dragDropFinished.connect(self.selectionModel.onModelItemsReordered)
        self.view = QtWidgets.QListView()
        self.view.setModel(self.model)
        self.view.setSelectionModel(self.selectionModel)
        self.view.setDragDropMode(QtWidgets.QAbstractItemView.InternalMove)
        self.view.setDragDropOverwriteMode(False)
        self.setCentralWidget(self.view)
runnix.py 文件源码 项目:runnix 作者: TheInitializer 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self):
        QtWidgets.QMainWindow.__init__(self)

        self.ui = uic.loadUi(l('mainwindow.ui'), self)
        self.ui.show()

        self.ui.runIcon.pixmap = l("run_37198.jpg")

        self.okButton.clicked.connect(self.run)
        self.commandBox.lineEdit().returnPressed.connect(self.run)

        self.commandBox.setFocus()
matplotlib-client.py 文件源码 项目:Auspex 作者: BBN-Q 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __init__(self, hostname=None, status_port=7771, data_port=7772):
        QtWidgets.QMainWindow.__init__(self)
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        self.setWindowTitle("Auspex Plotting")

        self.file_menu = self.menuBar().addMenu('&File')
        self.file_menu.addAction('&Quit', self.fileQuit,
                                 QtCore.Qt.CTRL + QtCore.Qt.Key_Q)
        self.file_menu.addAction('&Open', self.open_connection_dialog,
                                 QtCore.Qt.CTRL + QtCore.Qt.Key_O)
        self.file_menu.addAction('&Open Localhost', lambda: self.open_connection("localhost"),
                                 QtCore.Qt.SHIFT + QtCore.Qt.CTRL + QtCore.Qt.Key_O)
        self.recent = self.file_menu.addMenu("Open Recent")

        self.main_widget = QtWidgets.QWidget(self)
        self.main_widget.setMinimumWidth(800)
        self.main_widget.setMinimumHeight(600)
        self.layout = QtWidgets.QVBoxLayout(self.main_widget)

        self.main_widget.setFocus()
        self.setCentralWidget(self.main_widget)

        self.context = zmq.Context()

        self.listener_thread = None

        if hostname:
            self.open_connection(hostname, status_port, data_port)
main.py 文件源码 项目:axopy 作者: ucdrascal 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def keyPressEvent(self, event):
        """Qt callback for key presses.

        This overrides the `QMainWindow` method. It does not need to be called
        directly and it doesn't need to be overriden. Connect to the
        :meth:`key_pressed` transmitter to handle key press events.
        """
        try:
            key = key_map[event.key()]
        except KeyError:
            return super().keyPressEvent(event)

        self.key_pressed(key)
qt5_app.py 文件源码 项目:pyopenvr 作者: cmbruns 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self, renderer, title):
        QApplication.__init__(self, sys.argv)
        self.window = QMainWindow()
        self.window.setWindowTitle(title)
        self.window.resize(800,600)
        # Get OpenGL 4.1 context
        glformat = QGLFormat()
        glformat.setVersion(4, 1)
        glformat.setProfile(QGLFormat.CoreProfile)
        glformat.setDoubleBuffer(False)
        self.glwidget = MyGlWidget(renderer, glformat, self)
        self.window.setCentralWidget(self.glwidget)
        self.window.show()
BATS.py 文件源码 项目:BATS-Bayesian-Adaptive-Trial-Simulator 作者: ContaTP 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def __init__(self, parent = None):

        QtWidgets.QMainWindow.__init__(self, parent)
        self.setWindowFlags(QtCore.Qt.Widget)
main_5-50.py 文件源码 项目:motorized_zoom_lens 作者: Kurokesu 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __init__(self, parent=None):
        QtWidgets.QMainWindow.__init__(self, parent)
        self.setupUi(self)

        self.btn_video.clicked.connect(self.start_video_clicked)
        self.btn_autofocus.setEnabled(False)

        self.push_zero.clicked.connect(self.zero_clicked)
        self.push_zero.setEnabled(False)

        self.btn_connect.clicked.connect(self.btn_connect_clicked)
        self.btn_autofocus.clicked.connect(self.btn_autofocus_clicked)

        self.dial_2.valueChanged.connect(self.adjust_1)
        self.dial_1.valueChanged.connect(self.adjust_2)

        self.group_controls.setEnabled(False)

        self.dial_2.setMaximum(max_1)
        self.dial_1.setMaximum(max_2)

        # setup video timer and widget
        w = self.widget_video.width()
        h = self.widget_video.height()
        self.widget_video = OwnImageWidget(self.widget_video)
        self.widget_video.resize(w, h)

        # setup update frame thread
        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.update_frame)
        self.timer.start(1)

        # setup com port comunication
        self.combo_ports.clear()
        com_ports = sorted(comports())
        for port, desc, hwid in com_ports:
            self.combo_ports.addItem(port)

        self.timer1 = QtCore.QTimer(self)
        self.timer1.timeout.connect(self.update_pos)
        self.timer1.start(1)
main_2.8-12.py 文件源码 项目:motorized_zoom_lens 作者: Kurokesu 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, parent=None):
        QtWidgets.QMainWindow.__init__(self, parent)
        self.setupUi(self)

        self.btn_video.clicked.connect(self.start_video_clicked)
        self.btn_autofocus.setEnabled(False)

        self.push_zero.clicked.connect(self.zero_clicked)
        self.push_zero.setEnabled(False)

        self.btn_connect.clicked.connect(self.btn_connect_clicked)
        self.btn_autofocus.clicked.connect(self.btn_autofocus_clicked)

        self.dial_1.valueChanged.connect(self.adjust_1)
        self.dial_2.valueChanged.connect(self.adjust_2)

        self.group_controls.setEnabled(False)

        self.dial_1.setMaximum(max_1)
        self.dial_2.setMaximum(max_2)

        # setup video timer and widget
        w = self.widget_video.width()
        h = self.widget_video.height()
        self.widget_video = OwnImageWidget(self.widget_video)
        self.widget_video.resize(w, h)

        # setup update frame thread
        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.update_frame)
        self.timer.start(1)

        # setup com port comunication
        self.combo_ports.clear()
        com_ports = sorted(comports())
        for port, desc, hwid in com_ports:
            self.combo_ports.addItem(port)

        self.timer1 = QtCore.QTimer(self)
        self.timer1.timeout.connect(self.update_pos)
        self.timer1.start(1)
main.py 文件源码 项目:DGP 作者: DynamicGravitySystems 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def new_project(self) -> QtWidgets.QMainWindow:
        new_window = True
        dialog = CreateProject()
        if dialog.exec_():
            self.log.info("Creating new project")
            project = dialog.project
            if new_window:
                self.log.debug("Opening project in new window")
                return MainWindow(project)
            else:
                self.project = project
                self.project.save()
                self.update_project()

    # TODO: This will eventually require a dialog to allow selection of project type
__init__.py 文件源码 项目:binja_dynamics 作者: ehennenfent 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def init_gui():
    """ Tries to find the main Binja window. If we've already found it, does nothing.
    Call this as many times as you want, just in case. """
    global main_window
    if main_window is None:
        app = QApplication.instance()
        main_window = [x for x in app.allWidgets() if x.__class__ is QMainWindow][0]
main_window.py 文件源码 项目:Enibar 作者: ENIB 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self):
        super().__init__()
        uic.loadUi('ui/main_window.ui', self)

        # The QListWidget item currently selected.
        self.selected = None

        # The nickname of th currently selected note.
        self.selected_nickname = None

        # Timer used to add a delay when selecting a note.
        self.timer = None

        # The secondary window currently opened. It' here to force having only
        # one window opened at a time.
        self.win = None

        # The mail window. This is needed to store the mail window which cannot
        # be used as a usual secondary window as it's a QMainWindow instead
        # of a QDiaload. A QMainWindow is required in order to have a menubar
        self.mail_window = None

        # Hack to count ecocups to add/delete.
        self.eco_diff = 0

        # Build the notes_list
        self.rebuild_notes_list()

        # Set product list header width
        self.product_list.setColumnWidth(0, 30)
        self.product_list.setColumnWidth(1, 128)
        self.product_list.setColumnWidth(2, 40)

        # Set the headers of the history in the note details.
        self.note_history.header().setStretchLastSection(False)
        self.note_history.header().setSectionResizeMode(
            2,
            QtWidgets.QHeaderView.Stretch
        )
        self.check_alcohol()
widgets.py 文件源码 项目:ripr 作者: pbiernat 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, *__args):
        super(BinjaDockWidget, self).__init__(*__args)
        self._app = QtWidgets.QApplication.instance()
        self._main_window = [x for x in self._app.allWidgets() if x.__class__ is QtWidgets.QMainWindow][0]
        self._tool_menu = [x for x in self._main_window.menuWidget().children() if x.__class__ is QtWidgets.QMenu and x.title() == u'&Tools'][0]
        self._main_window.addDockWidget(Qt.RightDockWidgetArea, self)
        self._tabs = QtWidgets.QTabWidget()
        self._tabs.setTabPosition(QtWidgets.QTabWidget.East)
        self.setWidget(self._tabs)
        self.addToolMenuAction('Toggle plugin dock', self.toggle)
        self.hide()
__init__.py 文件源码 项目:ripr 作者: pbiernat 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def instance():
    app = QtWidgets.QApplication.instance()
    main_window = [x for x in app.allWidgets() if x.__class__ is QtWidgets.QMainWindow][0]
    try:
        dock = [x for x in main_window.children() if x.__class__ is BinjaDockWidget][0]
    except:
        dock = BinjaDockWidget()

    return dock
application.py 文件源码 项目:vivisect-py3 作者: bat-serjo 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def __init__(self, appname, cmd):
        QtWidgets.QMainWindow.__init__(self)
        vq_hotkeys.HotKeyMixin.__init__(self)

        self._vq_appname = appname
        self._vq_dockwidgets = []

        self._vq_settings = QtCore.QSettings('invisigoth', application=appname, parent=self)
        self._vq_histfile = os.path.join(os.path.expanduser('~'), '.%s_history' % appname)

        self._dock_classes = {}

        self.vqInitDockWidgetClasses()

        self._vq_mbar = vq_menu.VQMenuBar()
        self.setMenuBar(self._vq_mbar)

        # AnimatedDocks, AllowNestedDocks, AllowTabbedDocks, ForceTabbedDocks, VerticalTabs
        self.setDockOptions(self.AnimatedDocks | self.AllowTabbedDocks)

        self._vq_cli = self.__cli_widget_class__(cmd)
        self._vq_cli.input.loadHistory(self._vq_histfile)
        self._vq_cli.sigCliQuit.connect(self.close)

        self.setCentralWidget(self._vq_cli)
        self.vqRestoreGuiSettings(self._vq_settings)


问题


面经


文章

微信
公众号

扫码关注公众号