Beispiel #1
0
def isHiDPI():
    screenH = QtWidgets.QDesktopWidget().screenGeometry().height()
    screenW = QtWidgets.QDesktopWidget().screenGeometry().width()
    if screenH < 1081 or screenW < 1921:  # Non HIDPI
        return False
    else:
        return True
Beispiel #2
0
    def _set_center_position(self):
        availableWidth = QtWidgets.QDesktopWidget().width()
        availableHeight = QtWidgets.QDesktopWidget().height()

        # 计算出窗口左上角的坐标
        x = (availableWidth - 280) / 2
        y = (availableHeight - 360) / 2
        self.setGeometry(QtCore.QRect(x, y, 280, 350))
        self.setFixedSize(280, 350)  # cannot resize window size
Beispiel #3
0
    def __init__(self):
        QMainWindow.__init__(self)
        self.ui = Ui_ringProgress()
        self.ui.setupUi(self)

        screen = QtWidgets.QDesktopWidget().screenGeometry()
        self.size = self.geometry()
        self.move((screen.width() - self.size.width()) // 2,
                  (screen.height() - self.size.height()) // 2)

        self.progressBarValue(0)

        self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
        self.setAttribute(QtCore.Qt.WA_TranslucentBackground)

        self.shadow = QGraphicsDropShadowEffect(self)
        self.shadow.setBlurRadius(20)
        self.shadow.setXOffset(0)
        self.shadow.setYOffset(0)
        self.shadow.setColor(QColor(0, 0, 0, 120))
        self.ui.circularBg.setGraphicsEffect(self.shadow)

        self.timer = QtCore.QTimer()
        self.timer.timeout.connect(self.progress)
        self.timer.start(15)
        self.show()
Beispiel #4
0
    def __init__(self, path, message='', w=240, h=200):
        _desk = QtWidgets.QDesktopWidget()
        self.W, self.H, self.w, self.h = _desk.width(), _desk.height(), w, h
        self.x = (self.W - self.w) / 2
        self.y = (self.H - self.h - 100) / 2

        self.widget = QtWidgets.QWidget()
        self.widget.setGeometry(self.x, self.y, self.w, self.h + 50)
        # self.widget.setWindowFlags(QtCore.Qt.FramelessWindowHint)
        # self.widget.setAttribute(QtCore.Qt.WA_TranslucentBackground)
        self.widget.show()

        self.label = QtWidgets.QLabel(self.widget)
        self.label.setGeometry(0, 0, self.w, self.h)
        self.movie = QtGui.QMovie(path)
        self.label.setMovie(self.movie)
        self.label.show()
        self.movie.setSpeed(100)
        self.movie.start()
        self.movie.stateChanged.connect(self._restart)

        self.label = QtWidgets.QLabel(self.widget)
        self.label.setText(message)
        self.label.setGeometry(10, self.h - 30, self.w, 30)
        self.label.show()
Beispiel #5
0
 def texture_linker_UI(self):
     window_name = "texture_swap"
     if cmds.window(window_name,exists = True):
         cmds.deleteUI(window_name, wnd = True)
     pointer = mui.MQtUtil.mainWindow()
     parent = shiboken2.wrapInstance(long(pointer),QtWidgets.QWidget)
     window = QtWidgets.QMainWindow(parent)
     window.setObjectName(window_name)
     window.setWindowTitle(window_name)
     main_widget = QtWidgets.QWidget()
     window.setCentralWidget(main_widget)
     window.setFixedSize(500,700)
     main_vertical_layout = QtWidgets.QVBoxLayout(main_widget)
     self.texture_thumbnails_listWidget = QtWidgets.QListWidget()
     self.texture_thumbnails_listWidget.setStyleSheet('QListWidget {background-color: #292929; color: #B0E0E6;}')
     self.texture_thumbnails_listWidget.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
     self.texture_thumbnails_listWidget.setIconSize(QtCore.QSize(214, 214))
     self.texture_thumbnails_listWidget.setViewMode(QtWidgets.QListView.IconMode)
     main_vertical_layout.addWidget(self.texture_thumbnails_listWidget)
     self.texture_thumbnails_listWidget.itemDoubleClicked.connect(self.fCheckLaunch)
     self.texture_thumbnails_listWidget.setFocusPolicy(QtCore.Qt.NoFocus)
     swap_textures_button = QtWidgets.QPushButton('swap textures')
     swap_textures_button.setFixedHeight(50)
     swap_textures_button.setStyleSheet("background-color:rgb(105,110,120)")
     swap_textures_button.setFont(QtGui.QFont('SansSerif', 12))
     main_vertical_layout.addWidget(swap_textures_button)
     swap_textures_button.pressed.connect(partial(self.texture_replace))
     self.populate_texture_window()
     fg = window.frameGeometry()
     cp = QtWidgets.QDesktopWidget().availableGeometry().center()
     fg.moveCenter(cp)
     window.move(fg.topLeft())
     window.setAttribute(QtCore.Qt.WA_DeleteOnClose)
     self.myScriptJobID = cmds.scriptJob(p = window_name, event=["SelectionChanged", self.populate_texture_window])
     window.show()
Beispiel #6
0
 def center(self):
     """Center this window on active screen."""
     frame_geometry = self.frameGeometry()
     available_geometry = QtWidgets.QDesktopWidget().availableGeometry()
     center_point = available_geometry.center()
     frame_geometry.moveCenter(center_point)
     self.move(frame_geometry.topLeft())
Beispiel #7
0
    def __init__(self):
        super().__init__()
        desktop = QtWidgets.QDesktopWidget()
        dpi = desktop.logicalDpiX()
        self.setWindowTitle("Wildcat")
        self.ratio = dpi / 96
        self.resize(1400 * self.ratio, 800 * self.ratio)

        # window icon
        self.icon = QtGui.QIcon()
        icon_file = resource_filename('wildcat', f'icons/NU Logo.png')
        self.icon.addFile(icon_file, QtCore.QSize(256, 256))
        self.setWindowIcon(self.icon)

        self.menubar = self.menuBar()
        self.setup_file_menu()
        self.current_dir = ''
        self.file_index = None

        self.mdi = QtWidgets.QMdiArea()
        self.setCentralWidget(self.mdi)

        self.defaults = {
            'sampling_freq': 10,
            'scan_rate': 400,
            'ramp_min': -0.4,
            'ramp_max': 1.3
        }
Beispiel #8
0
def _get_screen_size():
    """Return available screen size without space occupied by taskbar"""
    if _in_standalone():
        return [0, 0]

    rect = QtWidgets.QDesktopWidget().screenGeometry(-1)
    return [rect.width(), rect.height()]
Beispiel #9
0
    def __init__(self, child_process_queue: Queue, emitter: StatusEmitter,
                 *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.process_queue = child_process_queue
        self.emitter = emitter

        self.setWindowTitle("StudiOCR")

        desktop = Qw.QDesktopWidget()
        self.resize(
            desktop.availableGeometry(desktop.primaryScreen()).size() * 0.5)

        self.main_widget = MainUI(self.new_doc)

        # Set the central widget of the Window.
        self.setCentralWidget(self.main_widget)

        # Configure emitter
        self.emitter.document_process_status.connect(
            self.set_document_process_status)

        self.emitter.data_available.connect(
            self.main_widget.documents.display_new_document)

        self.docs_in_queue = 0
        self.current_doc_process_status = 0
Beispiel #10
0
    def __init__(self, widgets=None):
        self.win = qtw.QWidget()
        # TODO: add back once other style sheets are resolved
        # (currently makes selected thing in dropdown menu invisible)
        # self.win.setStyleSheet('background-color:#ffffff')
        rect = qtw.QDesktopWidget().screenGeometry()
        self.width, self.height = rect.width(), rect.height()
        self.win.setFixedSize(self.width, self.height)
        self.win.showFullScreen()
        self.win.keyPressEvent = _exit_on_esc

        # overall layout
        self.main_layout = qtw.QVBoxLayout(self.win)
        # scroll region
        self.scroll_area = qtw.QScrollArea()
        self.scroll_area.setAlignment(Qt.AlignCenter)
        self.scroll_area.setStyleSheet(scroll_style)
        self.main_layout.addWidget(self.scroll_area)

        # next button iterates through the stack
        self.widgets = SpecialStack()
        self.next_button = NextButton(self.height, self.widgets, self)

        # accept single widget or list of widgets (for multi-page experiments)
        # alternatively, we could've detected in the button whether the current
        # widget was a StackedWidget or not
        self.add_widgets(widgets)
        self.widgets.setFixedWidth(1.2 * self.height)
        self.scroll_area.setWidget(self.widgets)
        self.widgets.currentWidget().setSizePolicy(qtw.QSizePolicy.Preferred,
                                                   qtw.QSizePolicy.Preferred)
        self.widgets.adjustSize()
        self.main_layout.addWidget(self.next_button, Qt.AlignCenter)
        self.win.setLayout(self.main_layout)
Beispiel #11
0
    def reposition(self):
        try:
            data = self.load_preferences()

            # grab the window (there HAS to be a simpler way)
            window = self.parent().parent().parent().parent().parent()
            screen = QtWidgets.QDesktopWidget()
            primary_screen = screen.availableGeometry()
            secondary_screen = screen.availableGeometry(screen=1)

            position = data.get('position')
            if position == 'Primary screen, right edge':
                window.setGeometry(primary_screen.right() - 300, 30, 300, 600)
            elif position == 'Primary screen, left edge':
                window.setGeometry(primary_screen.left() - 0, 30, 300, 600)
            elif position == 'Secondary screen, right edge':
                window.setGeometry(secondary_screen.right() - 300, 30, 300,
                                   600)
            elif position == 'secondary screen, left edge':
                window.setGeometry(secondary_screen.left() - 0, 30, 300, 600)
            else:
                return

        except TypeError:
            print 'preferences not found'
Beispiel #12
0
  def __init__(self):
    super(MainWindow, self).__init__()
    self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
    self.setupUi(self)

    # Set the theme of the window
    # Propagates downward to every child widget
    if config.theme:
      stylesheet = open("themes/" + config.theme + ".qss", "r").read()
      self.setStyleSheet(stylesheet)

    # Set window size according to config
    if config.width and config.height:
      self.resize(config.width, config.height)

    # Move the window to the center of the screen
    rect = self.frameGeometry()
    centerPoint = QtWidgets.QDesktopWidget().availableGeometry().center()
    rect.moveCenter(centerPoint)
    self.move(rect.topLeft())

    # Create a browser instance
    browser = Browser()
    self.setCentralWidget(browser)

    # Show the window
    self.show()
Beispiel #13
0
 def centerOnScreen(self):
     ''' Useful mainly for rare cases that parent is not shown yet for centering on desktop
                           If parent is shown,  QMessageBox gets centered into it properly.'''
     size = self.size()
     desktopSize = QtWidgets.QDesktopWidget().screenGeometry()
     top = (desktopSize.height() / 2) - (size.height() / 2)
     left = (desktopSize.width() / 2) - (size.width() / 2)
     self.move(left, top)
Beispiel #14
0
 def centerOnScreen(self):
     """centerOnScreen() - Centers the window on the screen."""
     resolution = QtWidgets.QDesktopWidget().screenGeometry()
     frame = self.frameSize()
     self.move(
         (resolution.width() / 2) - (frame.width() / 2),
         (resolution.height() / 2) - (frame.height() / 2),
     )
Beispiel #15
0
 def setup_window_location(self):
     """
         Setup window properties.
     """
     screen = QtWidgets.QDesktopWidget().screenGeometry()
     x = screen.width()/2-(WINDOW_WIDTH/2)
     y = screen.height()/2-(WINDOW_HEIGHT/2)-screen.height()/12
     self.move(x, y)
Beispiel #16
0
def centraWindow(window):
    """
    Centra la ventana en el escritorio
    """
    screen = QtWidgets.QDesktopWidget().screenGeometry()
    size = window.geometry()
    window.move((screen.width() - size.width()) / 2,
                (screen.height() - size.height()) / 2)
Beispiel #17
0
 def run(self):
     self.layout.update()
     self.layout.activate()
     screenGeometry = QtWidgets.QDesktopWidget().screenGeometry()
     x = (screenGeometry.width() - self.width()) / 2
     y = (screenGeometry.height() - self.height()) / 2
     self.move(x, y)
     self.show()
Beispiel #18
0
 def centralizar(self):
     # geometry of the main window
     qr = self.frameGeometry()
     # center point of screen
     cp = QtWidgets.QDesktopWidget().availableGeometry().center()
     # move rectangle's center point to screen's center point
     qr.moveCenter(cp)
     # top left of rectangle becomes top left of window centering it
     self.move(qr.topLeft())
Beispiel #19
0
    def center_on_screen(self):
        """Center the main window on the user's screen at boot-up"""

        screen_resolution = QtWidgets.QDesktopWidget().screenGeometry()
        center_horizontal = ((screen_resolution.width() / 2) -
                             (self.frameSize().width() / 2))
        center_vertical = ((screen_resolution.height() / 2) -
                           (self.frameSize().height() / 2))
        self.move(center_horizontal, center_vertical)
    def center_application(self):
        """ center application
        centers the application to the user's screen """

        # set up the window of the application
        self.setGeometry(0, 0, 400, 500)
        frame_geometry = self.frameGeometry()
        centerPoint = QtWidgets.QDesktopWidget().availableGeometry().center()
        frame_geometry.moveCenter(centerPoint)
        self.move(frame_geometry.topLeft())
Beispiel #21
0
    def __init__(self):
        self.desktop = QtWidgets.QDesktopWidget()
        self.i = self.desktop.primaryScreen()
        self.rect = self.desktop.availableGeometry(self.i)
        self.n = self.desktop.screenCount()

        # primary screen parameters
        self.x = self.rect.x()
        self.y = self.rect.y()
        self.w = self.rect.width()
        self.h = self.rect.height()
    def exec_(self):
        """
        Wrapper for exec_
        :return:
        """

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

        super(SetExportVariables, self).exec_()
def open_parameter_tab(item, global_mouse_pos):
    node = hou.nodeBySessionId(int(item.data().get("session_id")))
    if node is None:
        return
    desktop = hou.ui.curDesktop()
    parm_pane_size = (400, 500)
    global_mouse_pos = global_mouse_pos.toTuple()
    desktop_widget = QtWidgets.QDesktopWidget()
    parm_pane_pos = (int(global_mouse_pos[0]-parm_pane_size[1]*0.5), int(desktop_widget.availableGeometry().height()-global_mouse_pos[1]-parm_pane_size[1]))
    pane = desktop.createFloatingPane(hou.paneTabType.Parm, parm_pane_pos, parm_pane_size)
    pane.setCurrentNode(node)
    pane.setShowNetworkControls(False)
Beispiel #24
0
 def initUI(self):
     width=640
     height=240
     q=QtWidgets.QDesktopWidget().availableGeometry()
     x=(q.width()-width)/2
     y=(q.height()-height)/2
     
     self.setObjectName('NewExcelDialog')
     self.setWindowTitle('Создать новую таблицу')
     self.resize(width, height)
     self.move(x, y)
     
     self.pathDBC=QtWidgets.QLineEdit(self)
     pathDBC_Viewbtn=QtWidgets.QPushButton('Обзор...', self)
     pathDBC_label=QtWidgets.QLabel(self)
     pathDBC_label.setText('Введите путь к DBC:')
     
     self.pathExcel=QtWidgets.QLineEdit(self)
     pathExcel_Viewbtn=QtWidgets.QPushButton('Обзор...', self)
     pathExcel_label=QtWidgets.QLabel(self)
     pathExcel_label.setText('Где сохранить таблицу Excel?')
     
     self.nameExcel=QtWidgets.QLineEdit(self)
     nameExcel_label=QtWidgets.QLabel(self)
     nameExcel_label.setText('Введите имя таблицы:')
     
     self.nameList=QtWidgets.QLineEdit(self)
     nameList_label=QtWidgets.QLabel(self)
     nameList_label.setText('Введите название листа:')
     
     next_btn=QtWidgets.QPushButton('Далее', self)
     
     gridbox=QtWidgets.QGridLayout(self)
     
     gridbox.addWidget(pathDBC_label, 0, 0)
     gridbox.addWidget(self.pathDBC, 1, 0)
     gridbox.addWidget(pathDBC_Viewbtn, 1, 1)
     
     gridbox.addWidget(pathExcel_label, 2, 0)
     gridbox.addWidget(self.pathExcel, 3, 0)
     gridbox.addWidget(pathExcel_Viewbtn, 3, 1)
     
     gridbox.addWidget(nameExcel_label, 4, 0)
     gridbox.addWidget(self.nameExcel, 5, 0, 1, 2)
     
     gridbox.addWidget(nameList_label, 6, 0)
     gridbox.addWidget(self.nameList, 7, 0, 1, 2)
     
     gridbox.addWidget(next_btn, 8, 1)
     
     pathDBC_Viewbtn.clicked.connect(self.openDBCpath)
     pathExcel_Viewbtn.clicked.connect(self.openExcelpath)
     next_btn.clicked.connect(self.next)
    def __init__(self, app):
        super().__init__()

        self.app = app

        self.setGeometry(500, 400, 500, 400)

        self.setWindowModified(True)
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
        self.setWindowIcon(QtGui.QIcon(app.get_icon()))

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

        layout = QtWidgets.QVBoxLayout()
        self.setLayout(layout)

        img = QtGui.QPixmap(app.get_icon())
        logo = QtWidgets.QLabel(self)
        logo.setPixmap(img)
        logo.setAlignment(QtCore.Qt.AlignBaseline | QtCore.Qt.AlignCenter)
        layout.addWidget(logo, 1,
                         QtCore.Qt.AlignBaseline | QtCore.Qt.AlignCenter)

        title = QtWidgets.QLabel(self)
        title.setText("OZW Admin")
        title.setFont(QtGui.QFont("Times", 28, QtGui.QFont.Bold))
        layout.addWidget(title, 0,
                         QtCore.Qt.AlignBaseline | QtCore.Qt.AlignCenter)

        self.header = QtWidgets.QLabel(self)
        self.header.setText("Checking plugs")
        self.header.setAlignment(QtCore.Qt.AlignCenter)
        layout.addWidget(self.header, 0,
                         QtCore.Qt.AlignBaseline | QtCore.Qt.AlignCenter)

        self.desc = QtWidgets.QLabel(self)
        self.desc.setText('...')
        self.desc.setAlignment(QtCore.Qt.AlignCenter)
        layout.addWidget(self.desc, 0,
                         QtCore.Qt.AlignBaseline | QtCore.Qt.AlignCenter)

        self.pgbar = QtWidgets.QProgressBar(self)
        layout.addWidget(self.pgbar)

        self.plugs = []
        self.pgval = 0

        self.pw = worker.PlugsWorker(self)
        self.exit_code = 0
Beispiel #26
0
    def __init__(self):
        super(LogWindow, self).__init__()

        self.textEdit = QtWidgets.QTextEdit()
        self.textEdit.setLineWrapMode(QtWidgets.QTextEdit.NoWrap)
        self.textEdit.setReadOnly(True)

        self.setCentralWidget(self.textEdit)
        self.setWindowTitle("Log")

        screenGeo = QtWidgets.QDesktopWidget().screenGeometry()
        # print screenGeo
        self.resize(700, 300)
        self.move(screenGeo.width() - 800, 40)
 def add_widgets(self, widgets):
     for widget in widgets:
         widget.setSizePolicy(qtw.QSizePolicy.Ignored,
                              qtw.QSizePolicy.Ignored)
         self.addWidget(widget)
     desktop = qtw.QDesktopWidget().screenGeometry()
     self.setFixedWidth(
         1.2 * desktop.height())  # magic number to match host widget size
     # initial widget should be properly sized
     self.currentWidget().setSizePolicy(qtw.QSizePolicy.Expanding,
                                        qtw.QSizePolicy.Expanding)
     self.currentWidget().adjustSize()
     self.adjustSize()
     self.widgets.extend(widgets)  # add to list
Beispiel #28
0
	def __init__(self, parent = None):
		super(AddLabel, self).__init__()
		self.setupUi(self)
		self.parent = parent
		self.setWindowFlags(Qt.Tool)
#		Move Window to Middle of Screen
		qr = self.frameGeometry()
		cp = QtWidgets.QDesktopWidget().availableGeometry().center()
		qr.moveCenter(cp)
		self.move(qr.topLeft())

		close = self.Button.button(QtWidgets.QDialogButtonBox.Cancel)
		close.clicked.connect(self.close)
		ok = self.Button.button(QtWidgets.QDialogButtonBox.Ok)
		ok.clicked.connect(self.addlabel)
 def __init__(self):
     QtWidgets.QWidget.__init__(self)
     self.resize(QtWidgets.QDesktopWidget().availableGeometry(self).size() *
                 0.6)
     self.scene = QtWidgets.QGraphicsScene()
     self.scene.setSceneRect(-3000, -4000, 6000, 8000)
     self.view = QtWidgets.QGraphicsView(self.scene)
     self.view.resize(self.size())
     self.view.fitInView(self.scene.sceneRect(), QtCore.Qt.KeepAspectRatio)
     self.view.setParent(self)
     self.view.setTransformationAnchor(QtWidgets.QGraphicsView.NoAnchor)
     self.view.setResizeAnchor(QtWidgets.QGraphicsView.NoAnchor)
     self.view.scale(3, -3)
     self.lines = []
     self.show()
Beispiel #30
0
    def __init__(self, folder_scanners, fich_png):
        QtWidgets.QDialog.__init__(self)

        self.vars = Scanner_vars(folder_scanners)

        self.fich_png = fich_png

        self.setWindowFlags(QtCore.Qt.WindowCloseButtonHint | QtCore.Qt.FramelessWindowHint)
        self.setWindowOpacity(self.vars.opacity)
        self.setGeometry(QtWidgets.QDesktopWidget().availableGeometry())

        self.path = None
        self.selecting = False
        self.selected = False
        self.x = self.y = self.width = self.height = 0