python类QDesktopWidget()的实例源码

BATS.py 文件源码 项目:BATS-Bayesian-Adaptive-Trial-Simulator 作者: ContaTP 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __init__(self, parent=None):

        QtWidgets.QFrame.__init__(self, parent)
        # No title bar, but keep the frame
        # self.setWindowFlags(QtCore.Qt.CustomizeWindowHint)
        # Set position of the frame
        self.screen = QtWidgets.QDesktopWidget().screenGeometry()
        # Set geometry
        self.setGeometry(self.screen.width()/8, 50, 1600, 900)
        self.setMinimumSize(0, 0)
        # Set Widgets
        self.sideWindow = SideFrame(self)
        self.mainWindow = MainFrame(self)
        # Set Layout
        self.appLayout = QtWidgets.QHBoxLayout()
        self.appLayout.addWidget(self.sideWindow, 2)
        self.appLayout.addWidget(self.mainWindow, 8)
        # Add layout
        self.appLayout.setContentsMargins(0, 0, 0, 0)
        self.appLayout.setSpacing(0)
        self.setLayout(self.appLayout)
        self.setWindowTitle("Bayesian Adaptive Trial Simulator")


    # Close the application
window_list.py 文件源码 项目:gpvdm 作者: roderickmackenzie 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def wpos_set_window(window,name):
    #print("set")
    global wlist
    for i in range(0,len(wlist)):
        if wlist[i].name==name:
            shape=QDesktopWidget().screenGeometry()

            desktop_w=shape.width()
            desktop_h=shape.height()

            w=window.width()
            h=window.height()

            x=int(wlist[i].x)
            y=int(wlist[i].y)
            if (x+w>desktop_w) or x<0:
                x=desktop_w/2-w/2
                #print("Reset with",x)
            if (y+h>desktop_h) or y<0:
                y=desktop_h/2-h/2
                #print("Reset height",y)
            window.move(x,y)
            break
add_case.py 文件源码 项目:uitester 作者: IfengAutomation 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.dBCommandLineHelper = DBCommandLineHelper()
        ui_dir_path = os.path.dirname(__file__)
        ui_file_path = os.path.join(ui_dir_path, 'add_case.ui')
        uic.loadUi(ui_file_path, self)

        screen = QDesktopWidget().screenGeometry()
        self.resize(screen.width() / 5 * 2, screen.height() / 5 * 2)

        self.search_button = SearchButton()
        self.tag_names_line_edit = TagLineEdit("tag_names_line_edit", self.search_button)
        self.tag_names_line_edit_adapter()
        self.tag_list = None

        self.result_widget = RunnerTableWidget(self.dBCommandLineHelper.query_case_all(), [])
        self.result_table_layout.insertWidget(0, self.result_widget)

        self.message_box = QMessageBox()

        self.search_button.clicked.connect(self.search_event)
        self.selectcasebtn.clicked.connect(self.select_event)
        self.casecancelbtn.clicked.connect(self.close)
add_device.py 文件源码 项目:uitester 作者: IfengAutomation 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.devices_radio_buttons = []
        self.data_count = None
        self.selected_data_number = 0  # init data number, '0' refer to all data
        self.selected_device_list = []

        ui_dir_path = os.path.dirname(__file__)
        ui_file_path = os.path.join(ui_dir_path, 'add_device.ui')
        uic.loadUi(ui_file_path, self)

        screen = QDesktopWidget().screenGeometry()
        self.resize(screen.width() / 6, screen.height() / 6)

        self.all_data_selected = True
        self.line_number_line_edit.hide()

        self.select_device_btn.clicked.connect(self.select_event)
        self.cancel_device_btn.clicked.connect(self.close)
        self.all_radio_btn.clicked.connect(self.data_all_radio_event)
        self.line_number_radio_btn.clicked.connect(self.data_specified_radio_event)

        self.message_box = QMessageBox()
        self.devices_list = []
videoframes.py 文件源码 项目:desktop-stream-viewer 作者: AbiosGaming 项目源码 文件源码 阅读 26 收藏 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
cursor.py 文件源码 项目:Laborejo 作者: hilbrichtsoftware 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__(self, parentScoreScene):
        super().__init__(0, 0,  0, 0)        # (x1, y1, x2, y2)
        self.parentScoreScene = parentScoreScene
        p = QtGui.QPen()
        p.setColor(QtGui.QColor("red"))
        p.setCosmetic(True)
        self.setPen(p)
        self.setAcceptHoverEvents(True)
        api.getCallbacksDatabase().setPlaybackTicks.append(self.setCursorPosition)
        api.getCallbacksDatabase().tracksChanged.append(self.setLineToWindowHeigth) #for new tracks
        api.getCallbacksDatabase().updateTempoTrack.append(self.setLineToWindowHeigth)
        self.setFlags(QtWidgets.QGraphicsItem.ItemIsMovable)
        self.setAcceptedMouseButtons(QtCore.Qt.LeftButton)
        self.setZValue(90)
        #self.parentScoreScene.parentView.verticalScrollBar().valueChanged.connect(self.setLineToWindowHeigth)
        #self.hide()
        #self.maxHeight = QtWidgets.QDesktopWidget().geometry().height() #we really hope the screen resolution does not change during the session.
widgets.py 文件源码 项目:BigBrotherBot-For-UrT43 作者: ptitbigorneau 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def initUI(self):
        """
        Initialize the MainWindow layout.
        """
        self.setWindowTitle(B3_TITLE)
        self.setFixedSize(614, 512)
        ## INIT SUBCOMPONENTS
        self.setStatusBar(StatusBar(self))
        self.setMenuBar(MainMenuBar(self))
        self.setCentralWidget(CentralWidget(self))

        ## INIT SYSTEM TRAY ICON
        if b3.getPlatform() != 'linux':
            self.system_tray = SystemTrayIcon(self)
            self.system_tray.show()

        ## MOVE TO CENTER SCREEN
        screen = QDesktopWidget().screenGeometry()
        position_x = (screen.width() - self.geometry().width()) / 2
        position_y = (screen.height() - self.geometry().height()) / 2
        self.move(position_x, position_y)

    ############################################# EVENTS HANDLERS ######################################################
view.py 文件源码 项目:graph_LETI_project 作者: ItNoN 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def center(self):
        qr = self.frameGeometry()
        cp = QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())
        self.resize(1100,200)
gui.py 文件源码 项目:pbtk 作者: marin-m 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def set_view(self, view):
        if hasattr(self, 'view'):
            self.view.hide()
        view.show()
        self.view = view

        resolution = QDesktopWidget().screenGeometry()
        view.move((resolution.width() / 2) - (view.frameSize().width() / 2),
                  (resolution.height() / 2) - (view.frameSize().height() / 2))
GUI.py 文件源码 项目:coliform-project 作者: uprm-research-resto 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def center(self):

        qr = self.frameGeometry()
        cp = QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())
GUI.py 文件源码 项目:coliform-project 作者: uprm-research-resto 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def center(self):

        qr = self.frameGeometry()
        cp = QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())
GUI.py 文件源码 项目:coliform-project 作者: uprm-research-resto 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def center(self):

        qr = self.frameGeometry()
        cp = QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())
volume_raycasting_example.py 文件源码 项目:ModernGL-Volume-Raycasting-Example 作者: ulricheck 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def main():

    # assumes unsigned byte datatype and volume dimensions of 256x256x225
    volsize = (256, 256, 225)
    volume = load_raw(os.path.join("data", "head256.raw"), volsize)
    tff = load_transferfunction(os.path.join("data", "tff.dat"))

    app = QtWidgets.QApplication([])
    window = QGLControllerWidget(volume, volsize, tff)
    window.move(QtWidgets.QDesktopWidget().rect().center() - window.rect().center())
    window.show()
    app.exec_()
notepad.py 文件源码 项目:notepad 作者: lfsando 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def center(self):
        """Center the window"""

        frame = self.frameGeometry()
        center_point = QtWidgets.QDesktopWidget().availableGeometry().center()
        frame.moveCenter(center_point)
        self.move(frame.topLeft())

    # EVENTS
kiosk.py 文件源码 项目:vanessa-singleapp 作者: silverbulleters-research 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def center(self):
        qr = self.frameGeometry()
        cp = QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())
GuiUtils.py 文件源码 项目:PINCE 作者: korcankaraokcu 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def center(window):
    """Center the given window to desktop

    Args:
        window (QMainWindow, QWidget etc.): The window that'll be centered to desktop
    """
    window.move(QDesktopWidget().availableGeometry().center() - window.frameGeometry().center())


#:tag:GUI
spectrum_pref.py 文件源码 项目:gpvdm 作者: roderickmackenzie 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def center(self):
        qr = self.frameGeometry()
        cp = QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())
window_list.py 文件源码 项目:gpvdm 作者: roderickmackenzie 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def resize_window_to_be_sane(window,x,y):
    shape=QDesktopWidget().screenGeometry()
    w=shape.width()*x
    h=shape.height()*y
    window.resize(w,h)
progress.py 文件源码 项目:gpvdm 作者: roderickmackenzie 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def start(self):
            shape=QDesktopWidget().screenGeometry()

            w=shape.width()
            h=shape.height()
            win_w=self.frameGeometry().width()
            win_h=self.frameGeometry().height()

            x=w-win_w
            y=0
            self.move(x,y)
            self.show()
solar_pref.py 文件源码 项目:gpvdm 作者: roderickmackenzie 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def center(self):
        qr = self.frameGeometry()
        cp = QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())
help.py 文件源码 项目:gpvdm 作者: roderickmackenzie 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def move_window(self):
        shape=QDesktopWidget().screenGeometry()

        w=shape.width()
        h=shape.height()
        win_w=self.frameGeometry().width()
        win_h=self.frameGeometry().height()

        x=w-win_w
        y=50
        self.move(x,y)
spectrum_main.py 文件源码 项目:gpvdm 作者: roderickmackenzie 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def center(self):
        qr = self.frameGeometry()
        cp = QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())
entry.py 文件源码 项目:ciba 作者: FindHao 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def refresh_window(self, text):
        """???????"""
        # ???????
        self.setFixedSize(400, 300)
        cur = QtGui.QCursor.pos()
        x = cur.x() + 20
        y = cur.y() + 20
        # ????????????????
        window_h = QDesktopWidget().screenGeometry().height()
        window_w = QDesktopWidget().screenGeometry().width()
        if x + 400 > window_h or y + 300 > window_w:
            x -= 20 + 400
            y -= 20 + 300
        self.move(x, y)

        self.setWindowTitle("search for:")
        self.search_words.setText(text)
        # ???????
        self.voice_play2.hide()
        self.voice_play1.hide()
        if len(self.query.word.voices) >= 2:
            self.voice_label1.setText(self.query.word.voices[1][0])
            self.voice_label2.setText(self.query.word.voices[0][0])
            print(self.query.word.voices[1][0])
            # self.voice_play1.clicked.connect(lambda: self.play_voice(self.query.word.voices[0][1]))
            # self.voice_play2.clicked.connect(lambda: self.play_voice(self.query.word.voices[1][1]))
            self.play_voice(self.query.word.voices[1][1])
        elif len(self.query.word.voices) == 1:
            print("lenth 1")
            self.voice_label1.setText(self.query.word.voices[0][0])
            # self.voice_play1.clicked.connect(lambda: self.play_voice(self.query.word.voices[0][1]))
            self.play_voice(self.query.word.voices[0][1])
        else:
            self.voice_label1.setText("No voices found.")

        base_info = ''
        for x in self.query.word.props:
            base_info += x + self.query.word.props[x] + '\n'
        self.base_infor_label.setText(base_info)
main_window.py 文件源码 项目:uitester 作者: IfengAutomation 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.show_case_editor_signal.connect(self.show_case_editor, Qt.QueuedConnection)
        ui_dir_path = os.path.dirname(__file__)
        ui_file_path = os.path.join(ui_dir_path, 'mainwindow.ui')
        uic.loadUi(ui_file_path, self)
        # todo ??????
        screen = QDesktopWidget().screenGeometry()
        self.resize(screen.width() / 2, screen.height() / 2)
        self.setMinimumSize(700, 350)
        self.setWindowTitle("uitest")
        self.move((screen.width() - self.width()) / 2, (screen.height() - self.height()) / 2)  # draw centered
        # Add tab "Case"
        case_manager_widget = CaseManagerWidget(self.show_case_editor_signal,
                                                self.tester)
        self.tabWidget.addTab(case_manager_widget, "Case")

        # Add tab "Run"
        case_run_widget = RunWidget(self.tester)
        self.tabWidget.addTab(case_run_widget, "Run")

        # Add tab "Report"
        case_report_widget = RunnerEventWidget()
        self.tabWidget.addTab(case_report_widget, "Report")

        # Add tab "Setting"
        case_setting_widget = SettingWidget()
        self.tabWidget.addTab(case_setting_widget, "Setting")

        self.refresh_case_data_signal.connect(case_manager_widget.refresh)
        self.message_box = QMessageBox()
        self.start_rpc_server()
        self.is_editor_close_cancel = False
case_editor.py 文件源码 项目:uitester 作者: IfengAutomation 项目源码 文件源码 阅读 37 收藏 0 点赞 0 评论 0
def init_ui(self):
        """
        init ui, include: resize window
        :return:
        """
        screen = QDesktopWidget().screenGeometry()
        self.resize(screen.width() / 2, screen.height() / 2)
        self.init_btn_icon()

        self.id_line_edit.hide()  # hide line_edit
        self.case_name_line_edit.setPlaceholderText("Case Name")
about.py 文件源码 项目:ovirt-desktop-client 作者: nkovacne 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def center(self):
        """
            Description: Just centers the window
            Arguments: None
            Returns: Nothing
        """

        qr = self.frameGeometry()
        cp = QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())
credentials.py 文件源码 项目:ovirt-desktop-client 作者: nkovacne 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def center(self):
        """
            Description: Just centers the window
            Arguments: None
            Returns: Nothing
        """

        qr = self.frameGeometry()
        cp = QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())
credentials.py 文件源码 项目:ovirt-desktop-client 作者: nkovacne 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def center(self):
        """
            Description: Just centers the window
            Arguments: None
            Returns: Nothing
        """

        qr = self.frameGeometry()
        cp = QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())
ovirtclient.py 文件源码 项目:ovirt-desktop-client 作者: nkovacne 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def center(self):
        """
            Description: Just centers the window
            Arguments: None
            Returns: Nothing
        """

        qr = self.frameGeometry()
        cp = QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())
prac6.py 文件源码 项目:py301 作者: PFLC 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def center(self):

        qr = self.frameGeometry()
        cp = QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())


问题


面经


文章

微信
公众号

扫码关注公众号