示例#1
0
 def center(self):
     """ Function to center the application
 """
     qRect = self.frameGeometry()
     centerPoint = QDesktopWidget().availableGeometry().center()
     qRect.moveCenter(centerPoint)
     self.move(qRect.topLeft())
示例#2
0
 def center(self):
     """ Function to center the application
     """
     qRect = self.frameGeometry()
     centerPoint = QDesktopWidget().availableGeometry().center()
     # First move the rectangle
     qRect.moveCenter(centerPoint)
     # move my window to the moved rectangle.
     self.move(qRect.topLeft())
示例#3
0
    def __init__(self,parent):
        global dao
        super(EditDeliverySlipDialog,self).__init__(parent)

        title = _("Create delivery slip")
        self.setWindowTitle(title)

        top_layout = QVBoxLayout()
        self.title_widget = TitleWidget(title,self)
        top_layout.addWidget(self.title_widget)

        self.info_label = QLabel()
        self.info_label.setWordWrap(True)
        top_layout.addWidget(self.info_label)

        self.buttons = QDialogButtonBox()
        self.buttons.addButton( QDialogButtonBox.StandardButton.Cancel)
        self.buttons.addButton( QDialogButtonBox.Ok)

        order_part_prototype = []
        order_part_prototype.append( TextLinePrototype('human_identifier',_('Part n.'),editable=False))
        order_part_prototype.append( TextLinePrototype('description',_('Description'),editable=False))
        order_part_prototype.append( IntegerNumberPrototype('qty',_('Qty plan.'),editable=False))
        order_part_prototype.append( IntegerNumberPrototype('tex2',_('Qty so far'),editable=False))
        order_part_prototype.append( IntegerNumberPrototype(None,_('Qty out now'),nullable=True))
        self.qty_out_column = len(order_part_prototype) - 1

        # order_part_prototype.append( IntegerNumberPrototype(None,_('Reglages'),nullable=True))
        # order_part_prototype.append( IntegerNumberPrototype(None,_('Derogation'),nullable=True))
        # order_part_prototype.append( IntegerNumberPrototype(None,_('Rebus'),nullable=True))


        self.controller_part = PrototypeController(self, order_part_prototype,None,freeze_row_count=True)
        self.controller_part.view.horizontalHeader().setResizeMode(QHeaderView.ResizeToContents)
        self.controller_part.view.horizontalHeader().setResizeMode(1,QHeaderView.Stretch)


        self.controller_part.setModel(TrackingProxyModel(self,order_part_prototype))
        self.close_order_checkbox = QCheckBox(_("Close the order"))

        top_layout.addWidget(self.controller_part.view) # self.time_tracks_view)
        # top_layout.addWidget(self._make_units_qaulifications_gui())
        top_layout.addWidget(self.close_order_checkbox)
        top_layout.addWidget(self.buttons)
        self.setLayout(top_layout)

        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)

        sg = QDesktopWidget().screenGeometry()
        self.setMinimumWidth(0.5*sg.width())
        self.setMinimumHeight(0.3*sg.height())

        self.slip_id = None
    def __init__(self, parent=None):
        QDialog.__init__(self, parent)
        self.ui = Ui_SubscriberDialog()
        self.ui.setupUi(self)

        self.subscriber = None
        self.tableWidget = None
        self.listWidget = None

        if USE_MAEMO_5:
            switchButton = self.ui.buttonBox.addButton(
                self.tr('Switch'), QDialogButtonBox.ActionRole)
            switchButton.clicked.connect(self.switchRequested)

            self.tableWidget = self.ui.tableWidget
            headerLabels = ('Key', 'Value', 'Type')
            self.tableWidget.setColumnCount(3)
            self.tableWidget.setHorizontalHeaderLabels(headerLabels)
            horizontalHeader = self.tableWidget.horizontalHeader()
            horizontalHeader.setStretchLastSection(True)
            verticalHeader = self.tableWidget.verticalHeader()
            verticalHeader.setVisible(False)
            self.tableWidget.setColumnWidth(0, 200)
            self.tableWidget.setColumnWidth(1, 400)
        else:
            desktopWidget = QDesktopWidget()
            if desktopWidget.availableGeometry().width() < 400:
                # Screen is too small to fit a table widget without scrolling, use a list widget instead.
                self.listWidget = QListWidget()
                self.listWidget.setAlternatingRowColors(True)
                self.ui.verticalLayout.insertWidget(2, self.listWidget)
            else:
                self.tableWidget = QTableWidget()
                headerLabels = ('Key', 'Value', 'Type')
                self.tableWidget.setColumnCount(3)
                self.tableWidget.setHorizontalHeaderLabels(headerLabels)
                horizontalHeader = self.tableWidget.horizontalHeader()
                horizontalHeader.setStretchLastSection(True)
                self.tableWidget.verticalHeader()
                self.setVisible(False)
                self.ui.verticalLayout.insertWidget(2, self.tableWidget)

        self.ui.connectButton.clicked.connect(self.changeSubscriberPath)
        self.changeSubscriberPath()

        # if the default path does not exist reset it to /
        value = self.subscriber.value()
        subPaths = self.subscriber.subPaths()
        if not value and not subPaths:
            self.ui.basePath.setText('/')
            self.changeSubscriberPath()
示例#5
0
	def __init__(self, parent = None):
		# Initialize the constructor
		super(MainWindow, self).__init__(parent)

		# Show the application in fullscreen
		self.showFullScreen()
		
		# Setting the frames to be full screen
		desktop = QDesktopWidget()
		width = desktop.geometry().width()
		height = desktop.geometry().height()
		
		self.openglScreen = OpenglScreen(width, height)
		self.setCentralWidget(self.openglScreen)
示例#6
0
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)

        #widnow setup
        resolution = QDesktopWidget().screenGeometry()
        self.screen_w = resolution.width()
        self.screen_h = resolution.height()
        self.setGeometry(0, 0, 650, 200)
        self.setWindowTitle('bento dumper' + mof.get_version_suffix())
        self.setWindowIcon(QIcon('icons/run.png'))

        #center window
        qr = self.frameGeometry()
        cp = QtGui.QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())
        #adjust size
        self.resize(self.screen_w / 2, self.screen_h / 16)
        self.Menu()
        self.Layout()

        central_widget = QtGui.QWidget()
        central_widget.setLayout(self.main_layout)
        self.setCentralWidget(central_widget)
示例#7
0
 def setup(self):
     
     self.dirty = False
     
     self.def_cfg = copy.deepcopy(self.config)
     self.config.update_from_user_file()
     self.base_cfg = copy.deepcopy(self.config)
     
     self.categories = QListWidget()
     #self.categories.setSizePolicy(QSizePolicy.Fixed,QSizePolicy.Expanding)
     self.settings = QStackedWidget()
     #self.categories.setSizePolicy(QSizePolicy.MinimumExpanding,QSizePolicy.Expanding)
     
     QObject.connect(self.categories, SIGNAL('itemSelectionChanged()'), self.category_selected)
     
     self.widget_list = {}
     for cat in self.config.get_categories():
         self.widget_list[cat] = {}
     longest_cat = 0
     for cat in self.config.get_categories():
         if len(cat) > longest_cat:
             longest_cat = len(cat)
         self.categories.addItem(cat)
         settings_layout = QGridLayout()
         r = 0
         c = 0
         for setting in self.config.get_settings(cat):
             info = self.config.get_setting(cat, setting, True)
             s = QWidget()
             s.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Fixed)
             sl = QVBoxLayout()
             label = QLabel()
             if info.has_key('alias'):
                 label.setText(info['alias'])
             else:
                 label.setText(setting)
             if info.has_key('about'):
                 label.setToolTip(info['about'])
             sl.addWidget(label)
             if info['type'] == constants.CT_LINEEDIT:
                 w = LineEdit(self, self.config,cat,setting,info)
             elif info['type'] == constants.CT_CHECKBOX:
                 w = CheckBox(self, self.config,cat,setting,info)
             elif info['type'] == constants.CT_SPINBOX:
                 w = SpinBox(self, self.config,cat,setting,info)
             elif info['type'] == constants.CT_DBLSPINBOX:
                 w = DoubleSpinBox(self, self.config,cat,setting,info)
             elif info['type'] == constants.CT_COMBO:
                 w = ComboBox(self, self.config,cat,setting,info)
             w.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Fixed)
             self.widget_list[cat][setting] = w
             sl.addWidget(w)
             s.setLayout(sl)
             c = self.config.config[cat].index(setting) % 2
             settings_layout.addWidget(s, r, c)
             if c == 1:
                 r += 1
         settings = QWidget()
         settings.setLayout(settings_layout)
         settings_scroller = QScrollArea()
         settings_scroller.setWidget(settings)
         settings_scroller.setWidgetResizable(True)
         self.settings.addWidget(settings_scroller)
         
     font = self.categories.font()
     fm = QFontMetrics(font)
     self.categories.setMaximumWidth(fm.widthChar('X')*(longest_cat+4))
     
     self.main = QWidget()
     self.main_layout = QVBoxLayout()
     
     self.config_layout = QHBoxLayout()
     self.config_layout.addWidget(self.categories)
     self.config_layout.addWidget(self.settings)
     
     self.mainButtons = QDialogButtonBox(QDialogButtonBox.RestoreDefaults | QDialogButtonBox.Reset | QDialogButtonBox.Apply)
     self.main_apply = self.mainButtons.button(QDialogButtonBox.StandardButton.Apply)
     self.main_reset = self.mainButtons.button(QDialogButtonBox.StandardButton.Reset)
     self.main_defaults = self.mainButtons.button(QDialogButtonBox.StandardButton.LastButton)
     QObject.connect(self.mainButtons, SIGNAL('clicked(QAbstractButton *)'), self.mainbutton_clicked)
     
     self.dirty_check()
     
     self.main_layout.addLayout(self.config_layout)
     self.main_layout.addWidget(self.mainButtons)
     
     self.main.setLayout(self.main_layout)
     
     self.setCentralWidget(self.main)
     self.setWindowTitle(self.title)
     self.setUnifiedTitleAndToolBarOnMac(True)
     
     self.categories.setCurrentItem(self.categories.item(0))
     
     self.menuBar = QMenuBar()
     self.filemenu = QMenu('&File')
     self.quitAction = QAction(self)
     self.quitAction.setText('&Quit')
     if platform.system() != 'Darwin':
         self.quitAction.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_Q))
     QObject.connect(self.quitAction, SIGNAL('triggered()'), self.quitApp)
     self.filemenu.addAction(self.quitAction)
     self.menuBar.addMenu(self.filemenu)
     self.setMenuBar(self.menuBar)
     
     self.show()
     self.activateWindow()
     self.raise_()
     
     self.setMinimumWidth(self.geometry().width()*1.2)
     
     screen = QDesktopWidget().screenGeometry()
     size = self.geometry()
     self.move((screen.width()-size.width())/2, (screen.height()-size.height())/2)
 def center(self):
     # Center window
     qr = self.frameGeometry()
     qr.moveCenter(QDesktopWidget().availableGeometry().center())
     self.move(qr.topLeft())
示例#9
0
 def scale(self):
     """Scale widget to screen"""
     resolution = QDesktopWidget().screenGeometry()
     self.resize(resolution.width() / 2, resolution.height() / 6)
示例#10
0
 def position(self):
     """By default, position on top, centered"""
     resolution = QDesktopWidget().screenGeometry()
     self.move((resolution.width() - self.frameSize().width()) / 2,
               resolution.height() - self.frameSize().height() / 2)
示例#11
0
文件: __init__.py 项目: Firelinux/FQM
 def center(self):
     qrect = self.frameGeometry()
     cp = QDesktopWidget().availableGeometry().center()
     qrect.moveCenter(cp)
     self.move(qrect.topLeft())
示例#12
0
 def center(self, parent=None):
     screen = QDesktopWidget().screenGeometry()
     size = self.geometry()
     self.move((screen.width() - size.width()) / 2,
               (screen.height() - size.height()) / 2)
示例#13
0
 def center_window(self):
     coords = QDesktopWidget().availableGeometry().center()
     fg = self.ui.frameGeometry()
     fg.moveCenter(coords)
     self.ui.move(fg.topLeft())
示例#14
0
def place_dialog_on_screen(dialog, x_ratio=0.5, y_ratio=0.5):
    sg = QDesktopWidget().screenGeometry()
    dialog.setMinimumWidth(x_ratio*sg.width())
    dialog.setMinimumHeight(y_ratio*sg.height())
示例#15
0
    def __init__(self, parent=None):
        ''' sets up the whole main window '''

        #standard init
        super(MainWindow, self).__init__(parent)

        #set the window title
        self.setWindowTitle('Open Ephys Control GUI')

        self.window_height = 700
        self.window_width = 1100

        self.screen2 = QDesktopWidget().screenGeometry(0)
        self.move(
            self.screen2.left() +
            (self.screen2.width() - self.window_width) / 2.,
            self.screen2.top() +
            (self.screen2.height() - self.window_height) / 2.)

        self.get_info()
        self.noinfo = True

        while self.noinfo:
            loop = QEventLoop()
            QTimer.singleShot(500., loop.quit)
            loop.exec_()

        subprocess.Popen('start %s' % open_ephys_path, shell=True)

        self.collect_frame.connect(self.update_frame)
        self.collect_threshed.connect(self.update_threshed)
        self.acquiring = False
        self.recording = False

        self.video_height = self.window_height * .52
        self.video_width = self.window_width * .48

        self.resize(self.window_width, self.window_height)

        #create QTextEdit window 'terminal' for receiving stdout and stderr
        self.terminal = QTextEdit(self)
        #set the geometry
        self.terminal.setGeometry(
            QRect(self.window_width * .02,
                  self.window_height * .15 + self.video_height,
                  self.video_width * .96, 150))

        #make widgets
        self.setup_video_frames()
        self.setup_thresh_buttons()

        self.overlay = True

        #create thread and worker for video processing
        self.videoThread = QThread(self)
        self.videoThread.start()
        self.videoproc_worker = VideoWorker(self)
        self.videoproc_worker.moveToThread(self.videoThread)

        self.vt_file = None
        """""" """""" """""" """""" """""" """""" """""" """
        set up menus
        """ """""" """""" """""" """""" """""" """""" """"""

        #create a QMenuBar and set geometry
        self.menubar = QMenuBar(self)
        self.menubar.setGeometry(
            QRect(0, 0, self.window_width * .5, self.window_height * .03))
        #set the QMenuBar as menu bar for main window
        self.setMenuBar(self.menubar)

        #create a QStatusBar
        statusbar = QStatusBar(self)
        #set it as status bar for main window
        self.setStatusBar(statusbar)

        #create icon toolbar with default image
        iconToolBar = self.addToolBar("iconBar.png")

        #create a QAction for the acquire button
        self.action_Acq = QAction(self)
        #make it checkable
        self.action_Acq.setCheckable(True)
        #grab an icon for the button
        acq_icon = self.style().standardIcon(QStyle.SP_MediaPlay)
        #set the icon for the action
        self.action_Acq.setIcon(acq_icon)
        #when the button is pressed, call the Acquire function
        self.action_Acq.triggered.connect(self.Acquire)

        #create a QAction for the record button
        self.action_Record = QAction(self)
        #make it checkable
        self.action_Record.setCheckable(True)
        #grab an icon for the button
        record_icon = self.style().standardIcon(QStyle.SP_DialogYesButton)
        #set the icon for the action
        self.action_Record.setIcon(record_icon)
        #when the button is pressed, call advanced_settings function
        self.action_Record.triggered.connect(self.Record)

        #create QAction for stop button
        action_Stop = QAction(self)
        #grab close icon
        stop_icon = self.style().standardIcon(QStyle.SP_MediaStop)
        #set icon for action
        action_Stop.setIcon(stop_icon)
        #when button pressed, close window
        action_Stop.triggered.connect(self.Stop)

        #show tips for each action in the status bar
        self.action_Acq.setStatusTip("Start acquiring")
        self.action_Record.setStatusTip("Start recording")
        action_Stop.setStatusTip("Stop acquiring/recording")

        #add actions to icon toolbar
        iconToolBar.addAction(self.action_Acq)
        iconToolBar.addAction(self.action_Record)
        iconToolBar.addAction(action_Stop)

        #        self.sort_button = QPushButton('Sort Now',self)
        #        self.sort_button.setGeometry(QRect(self.window_width*.85,0,self.window_width*.15,self.window_height*.05))
        #        self.sort_button.clicked.connect(self.sort_now)

        #show the window if minimized by windows
        self.showMinimized()
        self.showNormal()
        """""" """""" """""" """""" """""" """""" """""" """""" """""" """""" ""
        """""" """""" """""" """""" """""" """""" """""" """""" """""" """""" ""
示例#16
0
    def __init__(self, parent=None):
        # Initialize the constructor
        super(MainWindow, self).__init__(parent)

        # Removes glances file - not needed
        if os.path.exists('GlancesNetclient.csv'):
            os.remove("GlancesNetclient.csv")

        # Define variables
        # Change to True to recreate post-drive screen
        self.summary = False

        self.initAll = False
        self.endDrive = False
        txtList = np.genfromtxt('largeSet.txt', dtype='str', delimiter='\n')
        ansList = np.genfromtxt('largeAnsSet.txt', dtype='int', delimiter='\n')
        # Creates the list of words with corresponding answer keys
        self.responseList = np.vstack((txtList, ansList)).T
        rnd = np.random.randint(0, self.responseList.shape[0] / 10)
        self.allList = self.responseList[rnd * 10:rnd * 10 + 10, :]

        self.counter = 0  # Defines the counter to go over list of phrases and answers
        self.response = np.nan  # Keeps track of the response
        self.trialNum = 0  # Keeps track of the trial number
        self.interact = 0  # Keeps track of the number of interactions

        # Set up the GUI
        self.setupUi(self)

        # Show the application in fullscreen
        self.showFullScreen()

        # Setting the frames to be full screen
        desktop = QDesktopWidget()
        width = desktop.geometry().width()
        height = desktop.geometry().height()

        # Create the graph object
        self.graph = Graph(width, height)

        # Hide all the frames except the initial
        self.introframe.show()
        self.readyframe.hide()
        self.feedbackframe.hide()
        self.gameframe.hide()
        self.endframe.hide()

        # Position and resize the frames.
        self.introframe.move(0, 0)
        self.introframe.resize(width, height)
        self.readyframe.move(0, 0)
        self.readyframe.resize(width, height)
        self.feedbackframe.move(0, 0)
        self.feedbackframe.resize(width, height)
        self.gameframe.move(0, 0)
        self.gameframe.resize(width, height)
        self.endframe.move(0, 0)
        self.endframe.resize(width, height)
        ''' BUTTONS '''
        # Button "DONE" on click
        QtCore.QObject.connect(self.btnDone, QtCore.SIGNAL("clicked()"),
                               self.showReadyFrame)
        # Moving UP/DOWN buttons
        QtCore.QObject.connect(self.btnUp, QtCore.SIGNAL("clicked()"),
                               self.moveUp)
        QtCore.QObject.connect(self.btnDown, QtCore.SIGNAL("clicked()"),
                               self.moveDown)
        self.btnUp.setEnabled(False)
        self.btnUp.setStyleSheet("QPushButton{background-color:#B0B0B0;}")
        # Selecting buttons
        QtCore.QObject.connect(self.btnLabelUp, QtCore.SIGNAL("clicked()"),
                               self.Uphighlight)
        QtCore.QObject.connect(self.btnLabelDown, QtCore.SIGNAL("clicked()"),
                               self.Downhighlight)
        # Button "SUBMIT" on click
        QtCore.QObject.connect(self.btnSubmit, QtCore.SIGNAL("clicked()"),
                               self.submitFun)
        # Button "START" on click
        QtCore.QObject.connect(self.btnStart, QtCore.SIGNAL("clicked()"),
                               self.showGameFrame)
        # Button "END" on click
        QtCore.QObject.connect(self.goButton, QtCore.SIGNAL("clicked()"),
                               self.showPostDrive)