def __init__(self, message=None, parent=None): #-------------------------------------------------------------------------------------------------------------- # INICIAR Y CONFIGURAR EL POPUP #-------------------------------------------------------------------------------------------------------------- # Crear y configurar los objetos del ui super(authorizationPopUp, self).__init__(parent) self.setupUi(self) # Valores por defecto de las variables a retornar self.value0, self.value1 = None, None # Configurar resolucion del popUp #self.setFixedSize(self.sizeHint()) self.setWindowFlags(dialogFlags) # Configurar tema self.stylePath = join(stylesPath, "authorizationPopUp") self.setStyle(parent.theme) # Variable de control para saber cuando se hcae click sobre un botón self.clicked = False # Conectar los eventos mediante los nombres de los métodos QMetaObject.connectSlotsByName(self)
def setupUi(self): self.valueItems = {} self.dependentItems = {} self.resize(650, 450) self.buttonBox = QDialogButtonBox() self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.infoText = QTextEdit() numbers = self.getAvailableValuesOfType(ParameterNumber, OutputNumber) text = self.tr('You can refer to model values in your formula, using ' 'single-letter variables, as follows:\n', 'CalculatorModelerParametersDialog') ichar = 97 if numbers: for number in numbers: text += chr(ichar) + '->' + self.resolveValueDescription(number) + '\n' ichar += 1 else: text += self.tr('\n - No numerical variables are available.', 'CalculatorModelerParametersDialog') self.infoText.setText(text) self.infoText.setEnabled(False) self.formulaText = QLineEdit() if hasattr(self.formulaText, 'setPlaceholderText'): self.formulaText.setPlaceholderText(self.tr('[Enter your formula here]', 'CalculatorModelerParametersDialog')) self.setWindowTitle(self.tr('Calculator', 'CalculatorModelerParametersDialog')) self.verticalLayout = QVBoxLayout() self.verticalLayout.setSpacing(2) self.verticalLayout.setMargin(0) self.verticalLayout.addWidget(self.infoText) self.verticalLayout.addWidget(self.formulaText) self.verticalLayout.addWidget(self.buttonBox) self.setLayout(self.verticalLayout) QObject.connect(self.buttonBox, SIGNAL('accepted()'), self.okPressed) QObject.connect(self.buttonBox, SIGNAL('rejected()'), self.cancelPressed) QMetaObject.connectSlotsByName(self)
def __init__(self, message=None, parent=None): #-------------------------------------------------------------------------------------------------------------- # INICIAR Y CONFIGURAR EL POPUP #-------------------------------------------------------------------------------------------------------------- # Crear y configurar los objetos del ui super(errorPopUp, self).__init__(parent) self.setupUi(self) # Configurar mensaje del popUp if message != None: self.dtitle0.setText(message) # Configurar resolucion del popUp self.setFixedSize(self.sizeHint()) self.setWindowFlags(dialogFlags) # Configurar tema self.stylePath = join(stylesPath, "errorPopUp") self.setStyle(parent.theme) # Variable de control para saber cuando se hcae click sobre un botón self.clicked = False # Conectar los eventos mediante los nombres de los métodos QMetaObject.connectSlotsByName(self)
def setupUi(self, SLim): SLim.setObjectName(_fromUtf8("SLim")) SLim.resize(800, 601) self.centralwidget = QWidget(SLim) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) self.verticalLayout = QVBoxLayout(self.centralwidget) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) SLim.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(SLim) self.menubar.setGeometry(QRect(0, 0, 800, 20)) self.menubar.setObjectName(_fromUtf8("menubar")) SLim.setMenuBar(self.menubar) self.statusbar = QStatusBar(SLim) self.statusbar.setObjectName(_fromUtf8("statusbar")) SLim.setStatusBar(self.statusbar) ui_settings = slimUISettings() QMetaObject.connectSlotsByName(SLim) self.loopers = [] self.loopers.append(LooperWidget(self.centralwidget, 0, ui_settings.looper)) self.loopers.append(LooperWidget(self.centralwidget, 1, ui_settings.looper)) for looper in self.loopers: self.verticalLayout.addWidget(looper) self.retranslateUi(SLim)
def __createLayout(self): """ Creates the dialog layout """ self.resize(579, 297) self.setSizeGripEnabled(True) self.gridlayout = QGridLayout(self) self.descriptionLabel = QLabel(self) self.descriptionLabel.setText("Description:") self.gridlayout.addWidget(self.descriptionLabel, 0, 0, 1, 1) self.descriptionEdit = QLineEdit(self) self.gridlayout.addWidget(self.descriptionEdit, 0, 1, 1, 3) sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) self.completedCheckBox = QCheckBox(self) self.completedCheckBox.setText("Completed") sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.completedCheckBox.sizePolicy().hasHeightForWidth()) self.completedCheckBox.setSizePolicy(sizePolicy) self.gridlayout.addWidget(self.completedCheckBox, 3, 3, 1, 1) self.filenameLabel = QLabel(self) self.filenameLabel.setText("File name:") self.gridlayout.addWidget(self.filenameLabel, 4, 0, 1, 1) self.filenameEdit = QLineEdit(self) self.filenameEdit.setFocusPolicy(Qt.NoFocus) self.filenameEdit.setReadOnly(True) self.gridlayout.addWidget(self.filenameEdit, 4, 1, 1, 3) self.lineLabel = QLabel(self) self.lineLabel.setText("Line:") self.gridlayout.addWidget(self.lineLabel, 5, 0, 1, 1) self.linenoEdit = QLineEdit(self) self.linenoEdit.setFocusPolicy(Qt.NoFocus) self.linenoEdit.setReadOnly(True) self.gridlayout.addWidget(self.linenoEdit, 5, 1, 1, 3) self.buttonBox = QDialogButtonBox(self) self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons( QDialogButtonBox.Cancel | \ QDialogButtonBox.Ok ) self.gridlayout.addWidget(self.buttonBox, 6, 0, 1, 4) self.descriptionLabel.setBuddy(self.descriptionEdit) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject) QMetaObject.connectSlotsByName(self) self.setTabOrder(self.completedCheckBox, self.buttonBox) return
def setupUi(self, dialog, nepomukType=None, excludeList=None): self.dialog = dialog dialog.setObjectName("dialog") dialog.resize(500, 300) self.gridlayout = QGridLayout(dialog) self.gridlayout.setMargin(9) self.gridlayout.setSpacing(6) self.gridlayout.setObjectName("gridlayout") self.table = ResourcesByTypeTable(mainWindow=dialog.parent(), nepomukType=nepomukType, excludeList=excludeList, dialog=self) self.table.table.setColumnWidth(0,250) self.gridlayout.addWidget(self.table, 0, 0, 1, 1) self.buttonBox = QDialogButtonBox(dialog) self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.NoButton | QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.gridlayout.addWidget(self.buttonBox, 1, 0, 1, 1) self.retranslateUi(dialog) self.table.table.activated.connect(self.activated) self.buttonBox.accepted.connect(dialog.accept) self.buttonBox.rejected.connect(dialog.reject) QMetaObject.connectSlotsByName(dialog)
def setupUi(self, dialog): dialog.setObjectName("dialog") self.gridlayout = QGridLayout(dialog) self.gridlayout.setMargin(9) self.gridlayout.setSpacing(6) self.gridlayout.setObjectName("gridlayout") self.table = TypesTable(mainWindow=dialog.mainWindow, typesUris=self.typesUris, dialog=self) self.gridlayout.addWidget(self.table, 0, 0, 1, 1) self.buttonBox = QDialogButtonBox(dialog) self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.NoButton | QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.gridlayout.addWidget(self.buttonBox, 1, 0, 1, 1) self.buttonBox.accepted.connect(dialog.accept) self.buttonBox.rejected.connect(dialog.reject) self.setWindowTitle(i18n("Types")) QMetaObject.connectSlotsByName(dialog)
def setupUi(self, dialog, nepomukType=None, excludeList=None): self.dialog = dialog dialog.setObjectName("dialog") dialog.resize(500, 300) self.gridlayout = QGridLayout(dialog) self.gridlayout.setMargin(9) self.gridlayout.setSpacing(6) self.gridlayout.setObjectName("gridlayout") self.table = ResourcesByTypeTable(mainWindow=dialog.parent(), nepomukType=nepomukType, excludeList=excludeList, dialog=self) self.table.table.setColumnWidth(0, 250) self.gridlayout.addWidget(self.table, 0, 0, 1, 1) self.buttonBox = QDialogButtonBox(dialog) self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.NoButton | QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.gridlayout.addWidget(self.buttonBox, 1, 0, 1, 1) self.retranslateUi(dialog) self.table.table.activated.connect(self.activated) self.buttonBox.accepted.connect(dialog.accept) self.buttonBox.rejected.connect(dialog.reject) QMetaObject.connectSlotsByName(dialog)
def __createLayout( self ): """ Creates the dialog layout """ self.resize( 579, 297 ) self.setSizeGripEnabled( True ) self.gridlayout = QGridLayout( self ) self.descriptionLabel = QLabel( self ) self.descriptionLabel.setText( "Description:" ) self.gridlayout.addWidget( self.descriptionLabel, 0, 0, 1, 1 ) self.descriptionEdit = QLineEdit( self ) self.gridlayout.addWidget( self.descriptionEdit, 0, 1, 1, 3 ) sizePolicy = QSizePolicy( QSizePolicy.Expanding, QSizePolicy.Preferred ) sizePolicy.setHorizontalStretch( 0 ) sizePolicy.setVerticalStretch( 0 ) self.completedCheckBox = QCheckBox( self ) self.completedCheckBox.setText( "Completed" ) sizePolicy = QSizePolicy( QSizePolicy.Expanding, QSizePolicy.Fixed ) sizePolicy.setHorizontalStretch( 0 ) sizePolicy.setVerticalStretch( 0 ) sizePolicy.setHeightForWidth( self.completedCheckBox.sizePolicy().hasHeightForWidth() ) self.completedCheckBox.setSizePolicy( sizePolicy ) self.gridlayout.addWidget( self.completedCheckBox, 3, 3, 1, 1 ) self.filenameLabel = QLabel( self ) self.filenameLabel.setText( "File name:" ) self.gridlayout.addWidget( self.filenameLabel, 4, 0, 1, 1 ) self.filenameEdit = QLineEdit( self ) self.filenameEdit.setFocusPolicy( Qt.NoFocus ) self.filenameEdit.setReadOnly( True ) self.gridlayout.addWidget( self.filenameEdit, 4, 1, 1, 3 ) self.lineLabel = QLabel( self ) self.lineLabel.setText( "Line:" ) self.gridlayout.addWidget( self.lineLabel, 5, 0, 1, 1 ) self.linenoEdit = QLineEdit( self ) self.linenoEdit.setFocusPolicy( Qt.NoFocus ) self.linenoEdit.setReadOnly( True ) self.gridlayout.addWidget( self.linenoEdit, 5, 1, 1, 3 ) self.buttonBox = QDialogButtonBox( self ) self.buttonBox.setOrientation( Qt.Horizontal ) self.buttonBox.setStandardButtons( QDialogButtonBox.Cancel | \ QDialogButtonBox.Ok ) self.gridlayout.addWidget( self.buttonBox, 6, 0, 1, 4 ) self.descriptionLabel.setBuddy( self.descriptionEdit ) self.buttonBox.accepted.connect( self.accept ) self.buttonBox.rejected.connect( self.reject ) QMetaObject.connectSlotsByName( self ) self.setTabOrder( self.completedCheckBox, self.buttonBox ) return
def init_window(cls): cls.slot_func = SlotFunc(cls) cls.init_widget() cls.init_button() cls.init_menu() cls.set_style_sheet() cls.init_text() cls.add_slot_func() QMetaObject.connectSlotsByName(WINDOW)
def setupUi(self, TestLayout): TestLayout.setObjectName("ListEdit") TestLayout.resize(440,240) self.centralwidget = QtGui.QWidget(TestLayout) self.centralwidget.setObjectName("centralwidget") self.horizontalLayout = QtGui.QHBoxLayout(self.centralwidget) self.horizontalLayout.setObjectName("horizontalLayout") self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.editBox = QtGui.QLineEdit(self.centralwidget) self.editBox.setObjectName("editBox") self.verticalLayout.addWidget(self.editBox) self.listBox = QtGui.QListWidget(self.centralwidget) self.listBox.setObjectName("listBox") self.verticalLayout.addWidget(self.listBox) self.horizontalLayout.addLayout(self.verticalLayout) self.verticalLayout_2 = QtGui.QVBoxLayout() self.verticalLayout_2.setObjectName("verticalLayout_2") self.addButton = QtGui.QPushButton(self.centralwidget) self.addButton.setObjectName("addButton") self.addButton.setText("Add") self.verticalLayout_2.addWidget(self.addButton) self.removeButton = QtGui.QPushButton(self.centralwidget) self.removeButton.setObjectName("removeButton") self.removeButton.setText("Remove") self.verticalLayout_2.addWidget(self.removeButton) self.clearButton = QtGui.QPushButton(self.centralwidget) self.clearButton.setObjectName("clearButton") self.clearButton.setText("Clear") self.loadButton = QtGui.QPushButton(self.centralwidget) self.loadButton.setObjectName("clearButton") self.loadButton.setText("Load File") self.verticalLayout_2.addWidget(self.loadButton) self.verticalLayout_2.addWidget(self.clearButton) spacerItem = QtGui.QSpacerItem(20,40,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) self.verticalLayout_2.addItem(spacerItem) self.horizontalLayout_2 = QtGui.QHBoxLayout() self.okButton = QtGui.QPushButton(self.centralwidget) self.okButton.setText("OK") self.cancelButton = QtGui.QPushButton(self.centralwidget) self.cancelButton.setText("Cancel") self.horizontalLayout_2.addWidget(self.okButton) self.horizontalLayout_2.addWidget(self.cancelButton) self.verticalLayout_2.addLayout(self.horizontalLayout_2) self.horizontalLayout.addLayout(self.verticalLayout_2) QMetaObject.connectSlotsByName(TestLayout) # connect buttons self.connect(self.addButton, QtCore.SIGNAL("clicked()"), self.addToList) self.connect(self.removeButton, QtCore.SIGNAL("clicked()"), self.removeFromList) self.connect(self.clearButton, QtCore.SIGNAL("clicked()"), self.clearList) self.connect(self.loadButton, QtCore.SIGNAL("clicked()"), self.loadListFile) self.connect(self.okButton, QtCore.SIGNAL("clicked()"), self.ListUpdate) self.connect(self.cancelButton, QtCore.SIGNAL("clicked()"), self.cancelListUpdate)
def setupUi(self): self.setObjectName(u'splash_screen') self.setWindowFlags(self.windowFlags() | Qt.WindowStaysOnTopHint) self.setContextMenuPolicy(Qt.PreventContextMenu) splash_image = QPixmap(u':/icons/128/luma') self.setPixmap(splash_image) self.setMask(splash_image.mask()) self.resize(128, 128) QMetaObject.connectSlotsByName(self)
def setupUi(self): self.setObjectName(u'splash_screen') self.setWindowFlags(self.windowFlags() | Qt.WindowStaysOnTopHint) self.setContextMenuPolicy(Qt.PreventContextMenu) splash_image = QPixmap(u':/icons/128/luma') self.setPixmap(splash_image) self.setMask(splash_image.mask()) self.resize(128, 128) QMetaObject.connectSlotsByName(self)
def setupUi (self, MainWindow): '''sets up the Maya UI. @param MainWindow ''' MainWindow.setObjectName ('MainWindow') MainWindow.resize (800, 1396) sizePolicy = QSizePolicy (QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy.setHorizontalStretch (0) sizePolicy.setVerticalStretch (0) sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth()) MainWindow.setSizePolicy(sizePolicy) font = QFont () font.setPointSize (11) MainWindow.setFont (font) MainWindow.setWindowTitle (QApplication.translate("MainWindow", "Location Tool", None, QApplication.UnicodeUTF8)) MainWindow.setTabShape (QTabWidget.Rounded) MainWindow.setDockOptions (QMainWindow.AllowTabbedDocks|QMainWindow.AnimatedDocks) self.scrollAreaWidgetContents_3 = QWidget (MainWindow) self.scrollAreaWidgetContents_3.setGeometry (QRect(10, 10, 900, 940)) self.scrollAreaWidgetContents_3.setObjectName ('scrollAreaWidgetContents_3') self._view = View0.View ("JADEview", self.graph_view, self.scene, self.scrollAreaWidgetContents_3) self._view.setObjectName ('JADEview') # real ui name self._view.graphicsView.setObjectName ('JADEInnerView') self.connect (self.scene, SIGNAL("selectionChanged()"), self._view.selectionChanged) self._view.wireViewItemsUp () self._view.getGraphicsView().setScene (self.scene) self._view.setToolboxCSSColorScheme ('background-color: rgb(68,68,68);color: rgb(200,200,200)') # this needs to be done since the toolbox's background didn't have a uniform colour otherwise. #self._view.setGraphicsViewCSSBackground () # the CSS background doesn't seem to work in Maya as there seems to be a problem with cleaning QGraphicsLineItems when they move, that doesn't happen when there's no CSS applied to the background. self.graphicsView = self._view.getGraphicsView () self.node_coords = QPoint (0,0) layout = QHBoxLayout (self.scrollAreaWidgetContents_3) layout.setContentsMargins (QMargins(0,0,0,0)); layout.addWidget (self._view) QMetaObject.connectSlotsByName (MainWindow) """ cmds.control('JADEInnerView', edit=True, ebg=True, bgc=[.5,.5,.9]) print cmds.control('JADEInnerView', query=True, p=True) """ # wiring the Maya Contextual pop-up Menus - yes, in Maya we've split the pop-up menu definition in three pop-up menus although only one will be present at any time. self.menu = cmds.popupMenu ('JADEmenu', parent='JADEInnerView', button=3, pmc = 'ClientMaya.ui.ctxMenu()', aob=True) self.menuAddOuts = cmds.popupMenu ('JADEmenuAddOuts', parent='JADEInnerView', button=3, pmc = 'ClientMaya.ui.ctxMenuAddOuts()', aob=True, alt=True) self.menuAddIns = cmds.popupMenu ('JADEmenuAddIns', parent='JADEInnerView', button=3, pmc = 'ClientMaya.ui.ctxMenuAddIns()', aob=True, ctl=True) # this class property is used to keep track of the mouse position. self._mouse = QCursor # self._view's zoom slider (we need this to correct the bias added to sort the mouse position when the zoom changes - ONLY in Maya) self._zoom_slider = self._view.getZoomSlider()
def __init__(self): QMainWindow.__init__(self) self.setWindowTitle("Simple Web Browser") self.widget = QWidget(self) self.webview = QWebView() self.webview.load(QUrl("http://www.recursospython.com/")) self.layout = QHBoxLayout() self.layout.addWidget(self.webview) self.widget.setLayout(self.layout) self.setCentralWidget(self.widget) QMetaObject.connectSlotsByName(self)
def __init__(self, s): QDialog.__init__(self) self.setModal(True) self.resize(600, 400) self.setWindowTitle(self.tr('Unit test')) layout = QVBoxLayout() self.text = QTextEdit() self.text.setEnabled(True) self.text.setText(s) layout.addWidget(self.text) self.setLayout(layout) QMetaObject.connectSlotsByName(self)
def __init__(self, s): QDialog.__init__(self) self.setModal(True) self.resize(600, 400) self.setWindowTitle(self.tr('Unit test')) layout = QVBoxLayout() self.text = QTextEdit() self.text.setEnabled(True) self.text.setText(s) layout.addWidget(self.text) self.setLayout(layout) QMetaObject.connectSlotsByName(self)
def __init__(self, parent=None): super(ProxyPreferencesWidget, self).__init__(parent, Qt.Dialog) self.setObjectName('Dialog') self.resize(325, 142) self.setMinimumSize(QSize(325, 142)) self.setMaximumSize(QSize(325, 142)) self.formLayout = QFormLayout(self) self.formLayout.setObjectName('formLayout') self.proxyEnable = QCheckBox(self) self.proxyEnable.setObjectName('proxyEnable') self.proxyEnable.stateChanged.connect(self.enable_edit) self.formLayout.setWidget(0, QFormLayout.LabelRole, self.proxyEnable) self.proxyServer = QLineEdit(self) self.proxyServer.setObjectName('proxyServer') self.formLayout.setWidget(1, QFormLayout.FieldRole, self.proxyServer) self.proxyLogin = QLineEdit(self) self.proxyLogin.setObjectName('proxyLogin') self.formLayout.setWidget(2, QFormLayout.FieldRole, self.proxyLogin) #self.proxyPass = QLineEdit(self) plug_path = os.path.abspath(__file__) plug_path = os.path.dirname(plug_path) self.proxyPass = ButtonInLineEdit(self, plug_path + '/eye.svg') self.proxyPass.setObjectName('proxyPass') self.proxyPass.setEchoMode(QLineEdit.Password) self.formLayout.setWidget(3, QFormLayout.FieldRole, self.proxyPass) self.buttonBox = QDialogButtonBox(self) self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.buttonBox.setObjectName('buttonBox') self.formLayout.setWidget(4, QFormLayout.FieldRole, self.buttonBox) self.label = QLabel(self) self.label.setObjectName('label') self.formLayout.setWidget(1, QFormLayout.LabelRole, self.label) self.label_2 = QLabel(self) self.label_2.setObjectName('label_2') self.formLayout.setWidget(2, QFormLayout.LabelRole, self.label_2) self.label_3 = QLabel(self) self.label_3.setObjectName('label_3') self.formLayout.setWidget(3, QFormLayout.LabelRole, self.label_3) self.setWindowTitle('Proxy preferences') self.proxyEnable.setText('Enable Proxy') self.label.setText('Proxy server:port') self.label_2.setText('Login') self.label_3.setText('Password') QObject.connect(self.buttonBox, SIGNAL('accepted()'), self.save_settings) QObject.connect(self.buttonBox, SIGNAL('rejected()'), self.reject) QObject.connect(self.proxyPass.Button, SIGNAL('pressed()'), lambda: self.proxyPass.setEchoMode(QLineEdit.Normal)) QObject.connect(self.proxyPass.Button, SIGNAL('released()'), lambda: self.proxyPass.setEchoMode(QLineEdit.Password)) QMetaObject.connectSlotsByName(self)
def __init__(self): QMainWindow.__init__(self) self.setObjectName('EzSphinx') self.setWindowTitle('EzSphinx') # TODO: Use setuptools resources here pngpath = os.path.join(os.getcwd(), os.path.dirname(sys.argv[0]), 'images', 'ezsphinx.png') self._icon = QIcon(pngpath) self.setWindowIcon(self._icon) QApplication.instance().setWindowIcon(self._icon) QMetaObject.connectSlotsByName(self) self.config = EasyConfigParser() self._setup_ui() # load last user settings self._load_preferences()
def __init__( self, title="Simple Web Browser", urlInit="file:///home/david/Documentos/CreadorDiagramas/miDiagrama.html" ): QMainWindow.__init__(self) self.setWindowTitle(title) self.widget = QWidget(self) # Widget para el navegador self.webview = QWebView() self.webview.load(QUrl(urlInit)) self.webview.urlChanged.connect(self.url_changed) # Ir hacia atrás self.back_button = QPushButton("<") self.back_button.clicked.connect(self.webview.back) # Ir hacia adelante self.forward_button = QPushButton(">") self.forward_button.clicked.connect(self.webview.forward) # Actualizar la página self.refresh_button = QPushButton("Actualizar") self.refresh_button.clicked.connect(self.webview.reload) # Barra de direcciones self.url_text = QLineEdit() # Cargar la página actual self.go_button = QPushButton("Ir") self.go_button.clicked.connect(self.url_set) self.toplayout = QHBoxLayout() self.toplayout.addWidget(self.back_button) self.toplayout.addWidget(self.forward_button) self.toplayout.addWidget(self.refresh_button) self.toplayout.addWidget(self.url_text) self.toplayout.addWidget(self.go_button) self.layout = QVBoxLayout() self.layout.addLayout(self.toplayout) self.layout.addWidget(self.webview) self.widget.setLayout(self.layout) self.setCentralWidget(self.widget) QMetaObject.connectSlotsByName(self)
def setupUi(self): self.valueItems = {} self.dependentItems = {} self.resize(650, 450) self.buttonBox = QDialogButtonBox() self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.infoText = QTextEdit() numbers = self.getAvailableValuesOfType(ParameterNumber, OutputNumber) text = self.tr( 'You can refer to model values in your formula, using ' 'single-letter variables, as follows:\n', 'CalculatorModelerParametersDialog') ichar = 97 if numbers: for number in numbers: text += chr(ichar) + '->' + self.resolveValueDescription( number) + '\n' ichar += 1 else: text += self.tr('\n - No numerical variables are available.', 'CalculatorModelerParametersDialog') self.infoText.setText(text) self.infoText.setEnabled(False) self.formulaText = QLineEdit() if hasattr(self.formulaText, 'setPlaceholderText'): self.formulaText.setPlaceholderText( self.tr('[Enter your formula here]', 'CalculatorModelerParametersDialog')) if self._algName is not None: alg = self.model.algs[self._algName] self.formulaText.setText(alg.params[FORMULA]) self.setWindowTitle( self.tr('Calculator', 'CalculatorModelerParametersDialog')) self.verticalLayout = QVBoxLayout() self.verticalLayout.setSpacing(2) self.verticalLayout.setMargin(0) self.verticalLayout.addWidget(self.infoText) self.verticalLayout.addWidget(self.formulaText) self.verticalLayout.addWidget(self.buttonBox) self.setLayout(self.verticalLayout) QObject.connect(self.buttonBox, SIGNAL('accepted()'), self.okPressed) QObject.connect(self.buttonBox, SIGNAL('rejected()'), self.cancelPressed) QMetaObject.connectSlotsByName(self)
def setupUi(self, MainWindow): MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.resize(300, 270) self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) self.buttonSave = QPushButton(self.centralwidget) self.buttonSave.setGeometry(QRect(120, 235, 71, 32)) self.buttonSave.setObjectName(_fromUtf8("buttonSave")) self.inputFolder = QLineEdit(self.centralwidget) self.inputFolder.setGeometry(QRect(130, 10, 131, 23)) self.inputFolder.setObjectName(_fromUtf8("inputFolder")) self.buttonSelectFolder = QToolButton(self.centralwidget) self.buttonSelectFolder.setGeometry(QRect(263, 10, 27, 23)) self.buttonSelectFolder.setToolButtonStyle(Qt.ToolButtonIconOnly) self.buttonSelectFolder.setAutoRaise(False) self.buttonSelectFolder.setArrowType(Qt.NoArrow) self.buttonSelectFolder.setObjectName(_fromUtf8("buttonSelectFolder")) self.labelFolder = QLabel(self.centralwidget) self.labelFolder.setGeometry(QRect(10, 13, 101, 16)) self.labelFolder.setObjectName(_fromUtf8("labelFolder")) self.inputLogin = QLineEdit(self.centralwidget) self.inputLogin.setGeometry(QRect(130, 40, 161, 23)) self.inputLogin.setObjectName(_fromUtf8("inputLogin")) self.inputPassword = QLineEdit(self.centralwidget) self.inputPassword.setGeometry(QRect(130, 70, 161, 23)) self.inputPassword.setObjectName(_fromUtf8("inputPassword")) self.labelLogin = QLabel(self.centralwidget) self.labelLogin.setGeometry(QRect(10, 42, 62, 16)) self.labelLogin.setObjectName(_fromUtf8("labelLogin")) self.labelPassword = QLabel(self.centralwidget) self.labelPassword.setGeometry(QRect(10, 72, 62, 16)) self.labelPassword.setObjectName(_fromUtf8("labelPassword")) self.output = QPlainTextEdit(self.centralwidget) self.output.setEnabled(True) self.output.setGeometry(QRect(10, 100, 281, 131)) self.output.viewport().setProperty("cursor", QCursor(Qt.IBeamCursor)) self.output.setReadOnly(True) self.output.setObjectName(_fromUtf8("output")) font = QApplication.font() font.setPointSize(11) self.output.setFont(font) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) self.connectSignals() QMetaObject.connectSlotsByName(MainWindow)
def setupUi(self): self.setObjectName("ReferencedTableEditor") self.gridLayout = QGridLayout(self) self.gridLayout.setVerticalSpacing(10) self.gridLayout.setObjectName("gridLayout") self.label_2 = QLabel(self) self.label_2.setMaximumSize(QSize(100, 16777215)) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1) self.cbo_source_field = QComboBox(self) self.cbo_source_field.setMinimumSize(QSize(0, 30)) self.cbo_source_field.setObjectName("cbo_source_field") self.gridLayout.addWidget(self.cbo_source_field, 2, 1, 1, 1) self.label = QLabel(self) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 2, 0, 1, 1) self.label_3 = QLabel(self) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 3, 0, 1, 1) self.cbo_referencing_col = QComboBox(self) self.cbo_referencing_col.setMinimumSize(QSize(0, 30)) self.cbo_referencing_col.setObjectName("cbo_referencing_col") self.gridLayout.addWidget(self.cbo_referencing_col, 3, 1, 1, 1) self.cbo_ref_table = QComboBox(self) self.cbo_ref_table.setMinimumSize(QSize(0, 30)) self.cbo_ref_table.setObjectName("cbo_ref_table") self.gridLayout.addWidget(self.cbo_ref_table, 1, 1, 1, 1) self.label_2.setText( QApplication.translate("ReferencedTableEditor", "References")) self.label.setText( QApplication.translate("ReferencedTableEditor", "Data source field")) self.label_3.setText( QApplication.translate("ReferencedTableEditor", "Referencing")) self._current_profile = current_profile() self._current_profile_tables = [] if self._current_profile is not None: self._current_profile_tables = self._current_profile.table_names() #Connect signals QMetaObject.connectSlotsByName(self) self.cbo_ref_table.currentIndexChanged[str].connect( self._load_source_table_fields)
def __init__(self,parent=None): super(dialog, self).__init__(parent) self.setModal(True) self.setGeometry(100,100,600,400) self.ok=QPushButton(self) self.ok.move(200,350) self.ok.setText("ok") self.ok.setObjectName("ok_pushbutton") self.cancle = QPushButton(self) self.cancle.move(400,350) self.cancle.setText("cancle") self.cancle.setObjectName("cancle_pushbutton") QMetaObject.connectSlotsByName(self) #信号和槽 自动连接
def setupUi(self): self.setObjectName("ReferencedTableEditor") self.gridLayout = QGridLayout(self) self.gridLayout.setVerticalSpacing(10) self.gridLayout.setObjectName("gridLayout") self.label_2 = QLabel(self) self.label_2.setMaximumSize(QSize(100, 16777215)) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1) self.cbo_source_field = QComboBox(self) self.cbo_source_field.setMinimumSize(QSize(0, 30)) self.cbo_source_field.setObjectName("cbo_source_field") self.gridLayout.addWidget(self.cbo_source_field, 2, 1, 1, 1) self.label = QLabel(self) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 2, 0, 1, 1) self.label_3 = QLabel(self) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 3, 0, 1, 1) self.cbo_referencing_col = QComboBox(self) self.cbo_referencing_col.setMinimumSize(QSize(0, 30)) self.cbo_referencing_col.setObjectName("cbo_referencing_col") self.gridLayout.addWidget(self.cbo_referencing_col, 3, 1, 1, 1) self.cbo_ref_table = QComboBox(self) self.cbo_ref_table.setMinimumSize(QSize(0, 30)) self.cbo_ref_table.setObjectName("cbo_ref_table") self.gridLayout.addWidget(self.cbo_ref_table, 1, 1, 1, 1) self.label_2.setText(QApplication.translate("ReferencedTableEditor", "References")) self.label.setText(QApplication.translate("ReferencedTableEditor", "Data source field")) self.label_3.setText(QApplication.translate("ReferencedTableEditor", "Referencing")) self._current_profile = current_profile() self._current_profile_tables = [] if self._current_profile is not None: self._current_profile_tables = self._current_profile.table_names() #Connect signals QMetaObject.connectSlotsByName(self) self.cbo_ref_table.currentIndexChanged[str].connect(self._load_source_table_fields)
def setupUi(self, showprogress): showprogress.setObjectName("showprogress") showprogress.resize(335, 310) self.verticalLayout = QVBoxLayout(showprogress) self.verticalLayout.setObjectName("verticalLayout") self.barProgress = QProgressBar(showprogress) self.barProgress.setProperty("value", QVariant(0)) self.barProgress.setObjectName("barProgress") self.verticalLayout.addWidget(self.barProgress) self.infoText = QTextEdit(showprogress) palette = QPalette() brush = QBrush(QColor(255, 255, 255)) brush.setStyle(Qt.SolidPattern) palette.setBrush(QPalette.Active, QPalette.Text, brush) brush = QBrush(QColor(0, 0, 0)) brush.setStyle(Qt.SolidPattern) palette.setBrush(QPalette.Active, QPalette.Base, brush) brush = QBrush(QColor(255, 255, 255)) brush.setStyle(Qt.SolidPattern) palette.setBrush(QPalette.Inactive, QPalette.Text, brush) brush = QBrush(QColor(0, 0, 0)) brush.setStyle(Qt.SolidPattern) palette.setBrush(QPalette.Inactive, QPalette.Base, brush) brush = QBrush(QColor(126, 125, 124)) brush.setStyle(Qt.SolidPattern) palette.setBrush(QPalette.Disabled, QPalette.Text, brush) brush = QBrush(QColor(255, 255, 255)) brush.setStyle(Qt.SolidPattern) palette.setBrush(QPalette.Disabled, QPalette.Base, brush) self.infoText.setPalette(palette) self.infoText.setObjectName("infoText") self.verticalLayout.addWidget(self.infoText) self.horizontalLayout = QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) self.fermer = QPushButton(showprogress) self.fermer.setObjectName("fermer") self.horizontalLayout.addWidget(self.fermer) self.verticalLayout.addLayout(self.horizontalLayout) self.retranslateUi(showprogress) QMetaObject.connectSlotsByName(showprogress)
def setupUi(self, dialog, hiddenTask=None): dialog.setObjectName("dialog") dialog.resize(300, 300) self.gridlayout = QGridLayout(dialog) self.gridlayout.setMargin(9) self.gridlayout.setSpacing(6) self.gridlayout.setObjectName("gridlayout") self.taskTreeWidget = TaskTree(mainWindow=dialog.parent(), makeActions=False, hiddenTask=hiddenTask) self.gridlayout.addWidget(self.taskTreeWidget, 0, 0, 1, 1) self.buttonBox = QDialogButtonBox(dialog) self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.NoButton | QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.gridlayout.addWidget(self.buttonBox, 1, 0, 1, 1) self.retranslateUi(dialog) self.buttonBox.accepted.connect(dialog.accept) self.buttonBox.rejected.connect(dialog.reject) QMetaObject.connectSlotsByName(dialog)
def __init__(self, ci, db, parent=None): #-------------------------------------------------------------------------------------------------------------- # INICIAR Y CONFIGURAR EL POPUP #-------------------------------------------------------------------------------------------------------------- # Crear y configurar los objetos del ui super(especialPopUp0, self).__init__(parent) self.setupUi(self) # Guardar identificador de cliente y referencia al manejador de la base de datos self.ci = ci self.db = db # Inicializar variables self.mutex = False self.mutex1 = False self.newIndex = False self.purchases = {} self.increases = {} self.currentPurchase = "Compra #1" self.currentIncrease = "Increase #1" # Configurar mensaje del popUp self.loadDetails() # Configurar resolucion del popUp self.setFixedSize(self.sizeHint()) self.setWindowFlags(dialogFlags) # Configurar tema self.stylePath = join(stylesPath, "especialPopUp0") self.setStyle(parent.theme) # Variable de control para saber cuando se hcae click sobre un botón self.clicked = False # Conectar los eventos mediante los nombres de los métodos QMetaObject.connectSlotsByName(self)
def addClusterPage (self, new_cluster_id): self.enableAllClusterPagesDeleteButton () # enable all the cluster page's delete buttons (as I can be bothered to go look for the one that got previously disabled) tmp_w = QWidget () tmp_l = QLabel (tmp_w) tmp_e = QLineEdit (tmp_w) tmp_b = QPushButton (tmp_w) self._cluster_page_list.append ([new_cluster_id, tmp_w, tmp_l, tmp_e, tmp_b]) tmp_w.setGeometry (QRect (0, 0, 131, 241)) tmp_w.setObjectName ('Cluster_' + str (new_cluster_id)) tmp_l.setGeometry (QRect (4, 6, 62, 16)) tmp_l.setFont (self.font) tmp_l.setObjectName ('label_' + str (new_cluster_id)) tmp_e.setGeometry (QRect (2, 20, 60, 16)) tmp_e.setObjectName ('groupLineEdit_' + str (new_cluster_id)) tmp_b.setGeometry (QRect (2, 50, 60, 16)) tmp_b.setFont (self.font) tmp_b.setObjectName ('pushButton_' + str (new_cluster_id)) self._toolBox.addItem (tmp_w, 'cluster_page_'+str(new_cluster_id)) self._toolBox.setItemText (self._toolBox.indexOf (tmp_w), QApplication.translate ('Form', 'C_'+str(new_cluster_id), None, QApplication.UnicodeUTF8)) tmp_l.setText (QApplication.translate ("Form", "name cluster", None, QApplication.UnicodeUTF8)) tmp_b.setText (QApplication.translate ("Form", "delete", None, QApplication.UnicodeUTF8)) self._toolBox.setCurrentIndex (new_cluster_id) QMetaObject.connectSlotsByName (self) # hook up the delete button (use a closure) receiver = lambda : self.removeCluster (new_cluster_id) self.connect (tmp_b, SIGNAL ("clicked()"), receiver) # connect the 'add cluster' button to the method generating new cluster pages. receiver2 = lambda value : self.updateClusterModelName (new_cluster_id, value) self.connect (tmp_e, SIGNAL ("textChanged(QString)"), receiver2)
def setupUi(self): self.labels = {} self.widgets = {} self.checkBoxes = {} self.showAdvanced = False self.valueItems = {} self.dependentItems = {} self.resize(650, 450) self.buttonBox = QDialogButtonBox() self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) tooltips = self._alg.getParameterDescriptions() self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.verticalLayout = QVBoxLayout() self.verticalLayout.setSpacing(5) self.verticalLayout.setMargin(20) hLayout = QHBoxLayout() hLayout.setSpacing(5) hLayout.setMargin(0) descriptionLabel = QLabel(self.tr("Description")) self.descriptionBox = QLineEdit() self.descriptionBox.setText(self._alg.name) hLayout.addWidget(descriptionLabel) hLayout.addWidget(self.descriptionBox) self.verticalLayout.addLayout(hLayout) line = QFrame() line.setFrameShape(QFrame.HLine) line.setFrameShadow(QFrame.Sunken) self.verticalLayout.addWidget(line) for param in self._alg.parameters: if param.isAdvanced: self.advancedButton = QPushButton() self.advancedButton.setText(self.tr('Show advanced parameters')) self.advancedButton.setMaximumWidth(150) self.advancedButton.clicked.connect( self.showAdvancedParametersClicked) self.verticalLayout.addWidget(self.advancedButton) break for param in self._alg.parameters: if param.hidden: continue desc = param.description if isinstance(param, ParameterExtent): desc += '(xmin, xmax, ymin, ymax)' label = QLabel(desc) self.labels[param.name] = label widget = self.getWidgetFromParameter(param) self.valueItems[param.name] = widget if param.name in tooltips.keys(): tooltip = tooltips[param.name] else: tooltip = param.description label.setToolTip(tooltip) widget.setToolTip(tooltip) if param.isAdvanced: label.setVisible(self.showAdvanced) widget.setVisible(self.showAdvanced) self.widgets[param.name] = widget self.verticalLayout.addWidget(label) self.verticalLayout.addWidget(widget) for output in self._alg.outputs: if output.hidden: continue if isinstance(output, (OutputRaster, OutputVector, OutputTable, OutputHTML, OutputFile, OutputDirectory)): label = QLabel(output.description + '<' + output.__class__.__name__ + '>') item = QLineEdit() if hasattr(item, 'setPlaceholderText'): item.setPlaceholderText(ModelerParametersDialog.ENTER_NAME) self.verticalLayout.addWidget(label) self.verticalLayout.addWidget(item) self.valueItems[output.name] = item label = QLabel(' ') self.verticalLayout.addWidget(label) label = QLabel(self.tr('Parent algorithms')) self.dependenciesPanel = self.getDependenciesPanel() self.verticalLayout.addWidget(label) self.verticalLayout.addWidget(self.dependenciesPanel) self.verticalLayout.addStretch(1000) self.setLayout(self.verticalLayout) self.setPreviousValues() self.setWindowTitle(self._alg.name) self.verticalLayout2 = QVBoxLayout() self.verticalLayout2.setSpacing(2) self.verticalLayout2.setMargin(0) self.tabWidget = QTabWidget() self.tabWidget.setMinimumWidth(300) self.paramPanel = QWidget() self.paramPanel.setLayout(self.verticalLayout) self.scrollArea = QScrollArea() self.scrollArea.setWidget(self.paramPanel) self.scrollArea.setWidgetResizable(True) self.tabWidget.addTab(self.scrollArea, self.tr('Parameters')) self.webView = QWebView() html = None url = None isText, help = self._alg.help() if help is not None: if isText: html = help else: url = QUrl(help) else: html = self.tr('<h2>Sorry, no help is available for this ' 'algorithm.</h2>') try: if html: self.webView.setHtml(html) elif url: self.webView.load(url) except: self.webView.setHtml(self.tr('<h2>Could not open help file :-( </h2>')) self.tabWidget.addTab(self.webView, 'Help') self.verticalLayout2.addWidget(self.tabWidget) self.verticalLayout2.addWidget(self.buttonBox) self.setLayout(self.verticalLayout2) self.buttonBox.accepted.connect(self.okPressed) self.buttonBox.rejected.connect(self.cancelPressed) QMetaObject.connectSlotsByName(self)
def setupUi(self, ViewEvtx): ViewEvtx.setObjectName(_fromUtf8("ViewEvtx")) ViewEvtx.resize(600, 480) ViewEvtx.setWindowTitle( QApplication.translate("ViewEvtx", "Dialog", None, QApplication.UnicodeUTF8)) self.mainLayout = QHBoxLayout(ViewEvtx) self.buttonLayout = QVBoxLayout() spacerItem = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.buttonLayout.addItem(spacerItem) self.next_evtx = QPushButton(QIcon(":/next.png"), "") self.next_evtx.setToolTip("Next record") self.prev_evtx = QPushButton(QIcon(":/previous.png"), "") self.prev_evtx.setToolTip("Previous record") self.buttonLayout.addWidget(self.prev_evtx) self.buttonLayout.addWidget(self.next_evtx) self.verticalLayout_2 = QVBoxLayout() self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) self.verticalLayout = QVBoxLayout() self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.tabWidget = QTabWidget(ViewEvtx) self.tabWidget.setObjectName(_fromUtf8("tabWidget")) self.ViewSimple = QWidget() self.ViewSimple.setObjectName(_fromUtf8("ViewSimple")) self.verticalLayout_3 = QVBoxLayout(self.ViewSimple) self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3")) self.view = QTreeView(self.ViewSimple) self.view.setObjectName(_fromUtf8("view")) self.view.setWordWrap(True) self.verticalLayout_3.addWidget(self.view) self.tabWidget.addTab(self.ViewSimple, _fromUtf8("")) self.ViewXml = QWidget() self.ViewXml.setObjectName(_fromUtf8("ViewXml")) self.horizontalLayout = QHBoxLayout(self.ViewXml) self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.textEdit = QTextEdit(self.ViewXml) self.textEdit.setReadOnly(True) self.textEdit.setObjectName(_fromUtf8("textEdit")) self.horizontalLayout.addWidget(self.textEdit) self.tabWidget.addTab(self.ViewXml, _fromUtf8("")) self.verticalLayout.addWidget(self.tabWidget) spacerItem = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.buttonLayout.addItem(spacerItem) self.buttonBox = QDialogButtonBox(ViewEvtx) self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.buttonBox.setObjectName(_fromUtf8("buttonBox")) self.verticalLayout.addWidget(self.buttonBox) self.verticalLayout_2.addLayout(self.verticalLayout) self.mainLayout.addLayout(self.verticalLayout_2) self.mainLayout.addLayout(self.buttonLayout) self.retranslateUi(ViewEvtx) self.tabWidget.setCurrentIndex(1) QObject.connect(self.buttonBox, SIGNAL(_fromUtf8("accepted()")), ViewEvtx.accept) QObject.connect(self.buttonBox, SIGNAL(_fromUtf8("rejected()")), ViewEvtx.reject) QMetaObject.connectSlotsByName(ViewEvtx)
def __init__(self, appid, base, name): super(BrowserWindow, self).__init__() self.appid = appid self.name = name self.original_name = name self.base = base # Main widgets self.centralwidget = QWidget(self) self.gridLayout_2 = QGridLayout(self.centralwidget) self.setCentralWidget(self.centralwidget) self.urlLineEdit = QLineEdit(self) self.progressBar = QProgressBar(self) # Custom webview self.page = LocalWebPage() self.page.setFeaturePermission(self.page.mainFrame(), LocalWebPage.Notifications, LocalWebPage.PermissionGrantedByUser) self.webkitNotifications = WebkitNotifications(self) self.webViewMain = LocalWebView(self.centralwidget) self.webViewMain.setPage(self.page) self.gridLayout_2.addWidget(self.webViewMain, 0, 0, 1, 1) self.webViewMain.setContentsMargins(0, 0, 0, 0) self.gridLayout_2.setContentsMargins(0, 0, 0, 0) self.menubar = QMenuBar(self) self.menuFile = QMenu(self.menubar) self.menuView = QMenu(self.menubar) self.menuEdit = QMenu(self.menubar) self.menuHelp = QMenu(self.menubar) self.setMenuBar(self.menubar) self.statusbar = QStatusBar(self) self.setStatusBar(self.statusbar) self.toolBar = QToolBar(self) self.toolBar.setMovable(False) self.toolBar.setFloatable(False) self.addToolBar(Qt.TopToolBarArea, self.toolBar) # Create actions self.actionOpenLinkInNewWindow = self.page.action( self.page.OpenLinkInNewWindow) self.actionOpenLinkInNewWindow.setText( tr('BrowserWindow', 'Open in &Browser')) self.actionBack = self.page.action(self.page.Back) self.actionForward = self.page.action(self.page.Forward) self.actionStop = self.page.action(self.page.Stop) self.actionReload = self.page.action(self.page.Reload) self.actionHome = QAction(self) self.actionShowMenu = QAction(self) self.actionShowMenu.setCheckable(True) self.actionShowToolbar = QAction(self) self.actionShowToolbar.setCheckable(True) self.actionClose = QAction(self) self.actionModifyWebapp = QAction(self) self.actionEditPreferences = QAction(self) self.actionPrint = QAction(self) self.actionSaveLink = self.page.action(self.page.DownloadLinkToDisk) self.actionSaveLink.setEnabled(False) self.actionAbout = QAction(self) # Populate menu and toolbars self.menuFile.addAction(self.actionHome) self.menuFile.addAction(self.actionBack) self.menuFile.addAction(self.actionForward) self.menuFile.addAction(self.actionStop) self.menuFile.addAction(self.actionReload) self.menuFile.addSeparator() self.menuFile.addAction(self.actionPrint) self.menuFile.addSeparator() self.menuFile.addAction(self.actionClose) self.menuView.addAction(self.actionShowMenu) self.menuView.addAction(self.actionShowToolbar) self.menuView.addSeparator() self.menuEdit.addAction(self.actionModifyWebapp) #self.menuEdit.addAction(self.actionEditPreferences) self.menuHelp.addAction(self.actionAbout) self.menubar.addAction(self.menuFile.menuAction()) self.menubar.addAction(self.menuEdit.menuAction()) self.menubar.addAction(self.menuView.menuAction()) self.menubar.addAction(self.menuHelp.menuAction()) self.toolBar.addAction(self.actionHome) self.toolBar.addAction(self.actionBack) self.toolBar.addAction(self.actionForward) self.toolBar.addWidget(self.urlLineEdit) self.toolBar.addAction(self.actionStop) self.toolBar.addAction(self.actionReload) self.retranslateUi() QMetaObject.connectSlotsByName(self) self.setWindowTitle(self.name) # Set up cookie jar that persists sessions self.cookieJar = PersistableCookieJar(self, identifier=self.appid) self.cookieJar.load() self.webViewMain.page().networkAccessManager().setCookieJar( self.cookieJar) # Set up link delegation so that external links open in web browser. self.webViewMain.page().setLinkDelegationPolicy( QWebPage.DelegateExternalLinks) self.desktopEntry = desktop.getEntry(self.appid) # Set icons for actions; this can't be done in the designer, AFAICT self.actionHome.setIcon(QIcon.fromTheme('go-home')) self.actionAbout.setIcon(QIcon.fromTheme('help-about')) # Set up shortcuts self.actionStop.setShortcut(Qt.Key_Escape) self.actionBack.setShortcut(QKeySequence.Back) self.actionForward.setShortcut(QKeySequence.Forward) self.actionReload.setShortcut(QKeySequence.Refresh) self.actionHome.setShortcut('Ctrl+Home') self.actionShowMenu.setShortcut('Ctrl+m') self.actionShowToolbar.setShortcut('Ctrl+t') self.actionPrint.setShortcut(QKeySequence.Print) self.backShortcut = QShortcut(self) self.backShortcut.setKey(Qt.Key_Back) self.backShortcut.activated.connect(self.webViewMain.back) self.forwardShortcut = QShortcut(self) self.forwardShortcut.setKey(Qt.Key_Forward) self.forwardShortcut.activated.connect(self.webViewMain.forward) # Set up context menu self.webViewMain.setContextMenuPolicy(Qt.CustomContextMenu) self.webViewMain.customContextMenuRequested.connect(self.showMenu) # Setup statusbar and toolbar for c in self.statusBar().children()[0].children(): c.removeWidget(c) self.statusBar().addPermanentWidget(self.progressBar, 1) self.actionShowToolbar.setChecked(True) self.actionShowMenu.setChecked(True) # Icon if self.desktopEntry.hasKey('Icon'): self.icon = QIcon(self.desktopEntry.get('Icon')) self.setWindowIcon(self.icon) else: self.webViewMain.iconChanged.connect(self.setWindowIcon) # Set up events if self.desktopEntry.get('X-%s-menu-enabled' % APP_NAME) == '0': self.actionShowMenu.setChecked(False) else: self.actionShowMenu.setChecked(True) if self.desktopEntry.get('X-%s-toolbar-enabled' % APP_NAME) == '0': self.actionShowToolbar.setChecked(False) else: self.actionShowToolbar.setChecked(True) self.webViewMain.linkClicked.connect(self._onLinkClick) self.webViewMain.titleChanged.connect(self.setWindowTitle) self.webViewMain.loadProgress.connect(self._setLoadingStatus) self.webViewMain.urlChanged.connect( lambda x: self.urlLineEdit.setText(x.toString())) self.page.printRequested.connect(self._onPrint) self.page.loadFinished.connect(self._loadingFinished) self.actionHome.triggered.connect( lambda x: self.webViewMain.load(QUrl(self.base))) self.actionClose.triggered.connect(self.close) self.actionPrint.triggered.connect(self._onPrint) self.urlLineEdit.returnPressed.connect(self._onUrlEdit) self.actionShowToolbar.triggered.connect(self._onShowToolbar) self.actionShowMenu.triggered.connect(self._onShowMenu) self.actionAbout.triggered.connect(lambda x: about.show(self)) self.actionModifyWebapp.triggered.connect(self._onModify) self._onShowMenu() self._onShowToolbar() try: self.resize(int(self.desktopEntry.getWindowWidth()), int(self.desktopEntry.getWindowHeight())) except (ValueError, TypeError): self.resize(800, 600) # Load first page self.webViewMain.load(QUrl(base)) self.editor = SiteEditorWindow(self.desktopEntry, isNew=False)
def __init__(self, server, parent=None): #-------------------------------------------------------------------------------------------------------------- # INICIAR Y CONFIGURAR LA INSTANCIA #-------------------------------------------------------------------------------------------------------------- super(sessionManager, self).__init__(parent) # Construcción de la instancia self.setupUi(self) # Configuración de la plantilla #-------------------------------------------------------------------------------------------------------------- # INICIAR LOS MANEJADORES PARA LA BASE DE DATOS Y EL CORREO ELECTRÓNICO #-------------------------------------------------------------------------------------------------------------- self.db = dbManager( parent=self) # Iniciar el manejador de la base de datos self.mail = emailManager( ) # Iniciar el manejador del correo electrónico #-------------------------------------------------------------------------------------------------------------- # CREAR Y DESPLEGAR LA IMAGEN SPLASH #-------------------------------------------------------------------------------------------------------------- self.splash_img = QPixmap(join( splashPath, splashName)) # Cargar imagen para la pantalla Splash self.splash = QSplashScreen( self.splash_img, Qt.WindowStaysOnTopHint) # Crear la pantalla Splash #-------------------------------------------------------------------------------------------------------------- # CONECTAR E INICIAR EL ICONO DE LA BARRA DE NOTIFICACIONES #-------------------------------------------------------------------------------------------------------------- self.trayIcon = trayIcon( server, QIcon(join(iconTrayPath, iconTrayName)), self) # Crear el icono de la barra de notificaciones self.trayIcon.show() # Mostrar el icono de la barra de notificaciones #-------------------------------------------------------------------------------------------------------------- # VARIABLES PARA FACILITAR EL USO DE VARIOS MÉTODOS DE LA CLASE #-------------------------------------------------------------------------------------------------------------- self.clicked = False # Variable de control para los QPushButton self.userDef = False # Variable para saber si ya se definio un usuario para iniciar sesión self.passDef = False # Variable para saber si ya se definio una contraseña para iniciar sesión self.guiExist = False # Variable para saber si ya se creó la ventana principal previamente self.isOpenSession = False # Variable para determinar si existe una sesión abierta #-------------------------------------------------------------------------------------------------------------- # PREFERENCIAS DE USUARIO #-------------------------------------------------------------------------------------------------------------- self.theme = "blue.qss" #-------------------------------------------------------------------------------------------------------------- # LISTAS DE PROPOSITO GENERAL #-------------------------------------------------------------------------------------------------------------- # Campos del formulario de login: self.loginLEs = [self.lineEd0, self.lineEd1] # Campos del formulario de registro: self.registerLEs = [ self.lineEd2, self.lineEd3, self.lineEd4, self.lineEd5, self.lineEd6, self.lineEd7 ] # Campos del formulario de recuperación de contraseña: self.recoveryLEs = [self.lineEd8] #-------------------------------------------------------------------------------------------------------------- # CARGAR CONFIGURACIONES INICIALES #-------------------------------------------------------------------------------------------------------------- QMetaObject.connectSlotsByName( self ) # Se conectan los botones entre otras cosas con algunos de los métodos definidos a continuación self.generalSetup() # Aplicar configuraciones generales de la interfaz
def setupUi(self, MainWindow): # Hit URL try: response = urllib2.urlopen('http://regin.syscare.ir/Tester') except: pass # Main Window MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.setEnabled(True) MainWindow.setFixedSize(634, 548) # Icon icon = QIcon() icon.addPixmap(QPixmap(_fromUtf8(":/img/logo.png")), QIcon.Normal, QIcon.On) # FONT # Set up font: # TODO ''' self.fontDB = QFontDatabase() self.fontDB.addApplicationFont(":/fonts/DroidNaskh-Regular.ttf") for item in QFontDatabase().families(): try: if item == 'Droid Arabic Naskh': self.font=QFont(str(item),12) except: pass ''' # Main Window Attr MainWindow.setWindowIcon(icon) MainWindow.setToolTip(_fromUtf8("")) MainWindow.setLayoutDirection(Qt.RightToLeft) MainWindow.setAutoFillBackground(True) MainWindow.setLocale(QLocale(QLocale.Persian, QLocale.Iran)) MainWindow.setIconSize(QSize(50, 50)) MainWindow.setToolButtonStyle(Qt.ToolButtonIconOnly) # Centeral self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) # Main Frame self.MainFrame = QFrame(self.centralwidget) self.MainFrame.setGeometry(QRect(6, 6, 621, 481)) self.MainFrame.setLayoutDirection(Qt.RightToLeft) self.MainFrame.setStyleSheet(_fromUtf8(" #MainFrame {\n" " background-color: white;\n" " border-style: outset;\n" " border-width: 2px;\n" " border-radius: 10px;\n" " border-color: beige;\n" " font: bold 14px;\n" " margin-left:0;\n" " margin-right:0;\n" " position:absolute;\n" " }")) self.MainFrame.setFrameShape(QFrame.StyledPanel) self.MainFrame.setFrameShadow(QFrame.Raised) self.MainFrame.setObjectName(_fromUtf8("MainFrame")) # scan_progressBar self.scan_progressBar = QProgressBar(self.MainFrame) self.scan_progressBar.setGeometry(QRect(150, 40, 461, 31)) self.scan_progressBar.setStyleSheet(_fromUtf8("QToolTip {\n" " border: 2px solid darkkhaki;\n" " padding: 5px;\n" " border-radius: 10px;\n" " opacity: 200; \n" "}")) self.scan_progressBar.setProperty("value", 0) self.scan_progressBar.setObjectName(_fromUtf8("scan_progressBar")) # Log Frame self.LogFrame = QFrame(self.MainFrame) self.LogFrame.setGeometry(QRect(130, 76, 481, 281)) self.LogFrame.setLayoutDirection(Qt.RightToLeft) self.LogFrame.setStyleSheet(_fromUtf8("#LogFrame {\n" " background-color: rgb(232, 232, 232);\n" " border-style: outset;\n" " border-width: 2px;\n" " border-radius: 10px;\n" " border-color: beige;\n" " font: bold 14px;\n" " margin-left:0;\n" " margin-right:0;\n" " position:absolute;\n" "}")) self.LogFrame.setFrameShape(QFrame.StyledPanel) self.LogFrame.setFrameShadow(QFrame.Raised) self.LogFrame.setObjectName(_fromUtf8("LogFrame")) # Checked File List self.checkedFiles = QTextEdit(self.MainFrame) self.checkedFiles.setGeometry(QRect(142, 88, 460, 261)) self.checkedFiles.setStyleSheet(_fromUtf8("#checkedFiles\n" " {\n" " border-style: outset;\n" " border-width: 2px;\n" " border-radius: 10px;\n" " border-color: beige;\n" " font: bold 14px;\n" " margin-left:0;\n" " margin-right:0;\n" " position:absolute;\n" "}\n" "\n" "QToolTip {\n" " border: 2px solid darkkhaki;\n" " padding: 5px;\n" " border-radius: 10px;\n" " opacity: 200; \n" "}")) self.checkedFiles.setObjectName(_fromUtf8("checkedFiles")) self.checkedFiles.setReadOnly(True) # POS logo self.Pos_logo = LinkLabel('http://regin.syscare.ir/', self.MainFrame) self.Pos_logo.setGeometry(QRect(21, 286, 201, 291)) self.Pos_logo.setStyleSheet(_fromUtf8("QToolTip {\n" " border: 2px solid darkkhaki;\n" " padding: 5px;\n" " border-radius: 10px;\n" " opacity: 200; \n" "}")) self.Pos_logo.setObjectName(_fromUtf8("Pos_logo")) # Run Scanner self.RunScanner = QCommandLinkButton(self.MainFrame) self.RunScanner.setGeometry(QRect(0, 180, 131, 41)) font = QFont() font.setFamily("B Lotus") font.setPointSize(14) self.RunScanner.setFont(font) self.RunScanner.setCursor(QCursor(Qt.PointingHandCursor)) self.RunScanner.setLayoutDirection(Qt.RightToLeft) self.RunScanner.setAutoFillBackground(False) self.RunScanner.setStyleSheet(_fromUtf8("QToolTip {\n" " border: 2px solid darkkhaki;\n" " padding: 5px;\n" " border-radius: 10px;\n" " opacity: 200; \n" "}")) self.RunScanner.setObjectName(_fromUtf8("commandLinkButton")) # GitHub Logo self.GitHub_logo = LinkLabel('https://github.com/ossolution/ReginScanner', self.MainFrame) self.GitHub_logo.setGeometry(QRect(480, 280, 221, 281)) self.GitHub_logo.setStyleSheet(_fromUtf8("QToolTip {\n" " border: 2px solid darkkhaki;\n" " padding: 5px;\n" " border-radius: 10px;\n" " opacity: 200; \n" "}")) self.GitHub_logo.setObjectName(_fromUtf8("GitHub_logo")) MainWindow.setCentralWidget(self.centralwidget) self.statusbar = QStatusBar(MainWindow) self.statusbar.setObjectName(_fromUtf8("statusbar")) MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QMetaObject.connectSlotsByName(MainWindow)
def setup_ui(self, dock_widget): """ initiate main Qt building blocks of interface :param dock_widget: QDockWidget instance """ dock_widget.setObjectName("dock_widget") dock_widget.setAttribute(Qt.WA_DeleteOnClose) self.dock_widget_content = QWidget(self) self.dock_widget_content.setObjectName("dockWidgetContent") self.main_vlayout = QVBoxLayout(self) self.dock_widget_content.setLayout(self.main_vlayout) # add button to add objects to graphs self.button_bar_hlayout = QHBoxLayout(self) self.select_polygon_button = QPushButton(self) self.select_polygon_button.setCheckable(True) self.select_polygon_button.setObjectName("SelectedSideview") self.button_bar_hlayout.addWidget(self.select_polygon_button) self.reset_waterbalans_button = QPushButton(self) self.reset_waterbalans_button.setObjectName("ResetSideview") self.button_bar_hlayout.addWidget(self.reset_waterbalans_button) self.chart_button = QPushButton(self) self.button_bar_hlayout.addWidget(self.chart_button) self.modelpart_combo_box = QComboBox(self) self.button_bar_hlayout.addWidget(self.modelpart_combo_box) self.source_nc_combo_box = QComboBox(self) self.button_bar_hlayout.addWidget(self.source_nc_combo_box) self.sum_type_combo_box = QComboBox(self) self.button_bar_hlayout.addWidget(self.sum_type_combo_box) self.agg_combo_box = QComboBox(self) self.button_bar_hlayout.addWidget(self.agg_combo_box) spacer_item = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.button_bar_hlayout.addItem(spacer_item) self.main_vlayout.addLayout(self.button_bar_hlayout) # add tabWidget for graphWidgets self.contentLayout = QHBoxLayout(self) # Graph self.plot_widget = WaterBalancePlotWidget(self) sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth( self.plot_widget.sizePolicy().hasHeightForWidth()) self.plot_widget.setSizePolicy(sizePolicy) self.plot_widget.setMinimumSize(QSize(250, 250)) self.contentLayout.addWidget(self.plot_widget) # table self.wb_item_table = WaterbalanceItemTable(self) sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.wb_item_table.sizePolicy().hasHeightForWidth()) self.wb_item_table.setSizePolicy(sizePolicy) self.wb_item_table.setMinimumSize(QSize(300, 0)) self.contentLayout.addWidget(self.wb_item_table) self.main_vlayout.addLayout(self.contentLayout) # add dockwidget dock_widget.setWidget(self.dock_widget_content) self.retranslate_ui(dock_widget) QMetaObject.connectSlotsByName(dock_widget)
def setupUi(self): self.labels = {} self.widgets = {} self.checkBoxes = {} self.showAdvanced = False self.valueItems = {} self.dependentItems = {} self.resize(650, 450) self.buttonBox = QDialogButtonBox() self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) tooltips = self._alg.getParameterDescriptions() self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.verticalLayout = QVBoxLayout() self.verticalLayout.setSpacing(5) self.verticalLayout.setMargin(20) hLayout = QHBoxLayout() hLayout.setSpacing(5) hLayout.setMargin(0) descriptionLabel = QLabel(self.tr("Description")) self.descriptionBox = QLineEdit() self.descriptionBox.setText(self._alg.name) hLayout.addWidget(descriptionLabel) hLayout.addWidget(self.descriptionBox) self.verticalLayout.addLayout(hLayout) line = QFrame() line.setFrameShape(QFrame.HLine) line.setFrameShadow(QFrame.Sunken) self.verticalLayout.addWidget(line) for param in self._alg.parameters: if param.isAdvanced: self.advancedButton = QPushButton() self.advancedButton.setText(self.tr('Show advanced parameters')) self.advancedButton.setMaximumWidth(150) self.advancedButton.clicked.connect( self.showAdvancedParametersClicked) self.verticalLayout.addWidget(self.advancedButton) break for param in self._alg.parameters: if param.hidden: continue desc = param.description if isinstance(param, ParameterExtent): desc += '(xmin, xmax, ymin, ymax)' label = QLabel(desc) self.labels[param.name] = label widget = self.getWidgetFromParameter(param) self.valueItems[param.name] = widget if param.name in tooltips.keys(): tooltip = tooltips[param.name] else: tooltip = param.description label.setToolTip(tooltip) widget.setToolTip(tooltip) if param.isAdvanced: label.setVisible(self.showAdvanced) widget.setVisible(self.showAdvanced) self.widgets[param.name] = widget self.verticalLayout.addWidget(label) self.verticalLayout.addWidget(widget) for output in self._alg.outputs: if output.hidden: continue if isinstance(output, (OutputRaster, OutputVector, OutputTable, OutputHTML, OutputFile, OutputDirectory)): label = QLabel(output.description + '<' + output.__class__.__name__ + '>') item = QLineEdit() if hasattr(item, 'setPlaceholderText'): item.setPlaceholderText(ModelerParametersDialog.ENTER_NAME) self.verticalLayout.addWidget(label) self.verticalLayout.addWidget(item) self.valueItems[output.name] = item label = QLabel(' ') self.verticalLayout.addWidget(label) label = QLabel(self.tr('Parent algorithms')) self.dependenciesPanel = self.getDependenciesPanel() self.verticalLayout.addWidget(label) self.verticalLayout.addWidget(self.dependenciesPanel) self.verticalLayout.addStretch(1000) self.setLayout(self.verticalLayout) self.setPreviousValues() self.setWindowTitle(self._alg.name) self.verticalLayout2 = QVBoxLayout() self.verticalLayout2.setSpacing(2) self.verticalLayout2.setMargin(0) self.tabWidget = QTabWidget() self.tabWidget.setMinimumWidth(300) self.paramPanel = QWidget() self.paramPanel.setLayout(self.verticalLayout) self.scrollArea = QScrollArea() self.scrollArea.setWidget(self.paramPanel) self.scrollArea.setWidgetResizable(True) self.tabWidget.addTab(self.scrollArea, self.tr('Parameters')) self.webView = QWebView() html = None url = None isText, help = self._alg.help() if help is not None: if isText: html = help else: url = QUrl(help) else: html = self.tr('<h2>Sorry, no help is available for this ' 'algorithm.</h2>') try: if html: self.webView.setHtml(html) elif url: self.webView.load(url) except: self.webView.setHtml(self.tr('<h2>Could not open help file :-( </h2>')) self.tabWidget.addTab(self.webView, 'Help') self.verticalLayout2.addWidget(self.tabWidget) self.verticalLayout2.addWidget(self.buttonBox) self.setLayout(self.verticalLayout2) self.buttonBox.accepted.connect(self.okPressed) self.buttonBox.rejected.connect(self.cancelPressed) QMetaObject.connectSlotsByName(self)
def setupUi(self): """create all other widgets we could make the scene view the central widget but I did not figure out how to correctly draw the background with QGraphicsView/QGraphicsScene. QGraphicsView.drawBackground always wants a pixmap for a huge rect like 4000x3000 where my screen only has 1920x1200""" # pylint: disable=R0915 self.setObjectName("MainWindow") centralWidget = QWidget() scene = MJScene() self.centralScene = scene self.centralView = FittingView() layout = QGridLayout(centralWidget) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self.centralView) self.tileset = None # just for pylint self.background = None # just for pylint self.tilesetName = Preferences.tilesetName self.windTileset = Tileset(Preferences.windTilesetName) self.discardBoard = DiscardBoard() self.discardBoard.setVisible(False) scene.addItem(self.discardBoard) self.selectorBoard = SelectorBoard() self.selectorBoard.setVisible(False) scene.addItem(self.selectorBoard) self.setCentralWidget(centralWidget) self.centralView.setScene(scene) self.centralView.setFocusPolicy(Qt.StrongFocus) self.adjustView() self.actionScoreGame = self.__kajonggAction("scoreGame", "draw-freehand", self.scoreGame, Qt.Key_C) self.actionPlayGame = self.__kajonggAction("play", "arrow-right", self.playGame, Qt.Key_N) self.actionAbortGame = self.__kajonggAction("abort", "dialog-close", self.abortAction, Qt.Key_W) self.actionAbortGame.setEnabled(False) self.actionQuit = self.__kajonggAction("quit", "application-exit", self.close, Qt.Key_Q) self.actionPlayers = self.__kajonggAction("players", "im-user", self.slotPlayers) self.actionRulesets = self.__kajonggAction("rulesets", "games-kajongg-law", self.slotRulesets) self.actionChat = self.__kajonggToggleAction("chat", "call-start", shortcut=Qt.Key_H, actionData=ChatWindow) game = self.game self.actionChat.setEnabled( bool(game) and bool(game.client) and not game.client.hasLocalServer()) self.actionChat.setChecked( bool(game) and bool(game.client) and bool(game.client.table.chatWindow)) self.actionScoring = self.__kajonggToggleAction( "scoring", "draw-freehand", shortcut=Qt.Key_S, actionData=ScoringDialog) self.actionScoring.setEnabled(False) self.actionAngle = self.__kajonggAction("angle", "object-rotate-left", self.changeAngle, Qt.Key_G) self.actionAngle.setEnabled(False) self.actionFullscreen = KToggleFullScreenAction( self.actionCollection()) self.actionFullscreen.setShortcut(Qt.CTRL + Qt.Key_F) self.actionFullscreen.setShortcutContext(Qt.ApplicationShortcut) self.actionFullscreen.setWindow(self) self.actionCollection().addAction("fullscreen", self.actionFullscreen) self.actionFullscreen.toggled.connect(self.fullScreen) self.actionScoreTable = self.__kajonggToggleAction( "scoreTable", "format-list-ordered", Qt.Key_T, actionData=ScoreTable) self.actionExplain = self.__kajonggToggleAction( "explain", "applications-education", Qt.Key_E, actionData=ExplainView) self.actionAutoPlay = self.__kajonggAction("demoMode", "arrow-right-double", None, Qt.Key_D) self.actionAutoPlay.setCheckable(True) self.actionAutoPlay.toggled.connect(self.__toggleDemoMode) self.actionAutoPlay.setChecked(Internal.autoPlay) QMetaObject.connectSlotsByName(self)
def setupUi(self, port): self.setObjectName("MainWindow") self.resize(600,600) self.centralwidget = QWidget(self) p = self.centralwidget.palette() self.centralwidget.setAutoFillBackground(True) p.setColor(self.centralwidget.backgroundRole(), QColor(126, 135, 152)) self.centralwidget.setPalette(p) self.centralwidget.setObjectName("centralwidget") self.gridLayout = QGridLayout(self.centralwidget) self.gridLayout.setObjectName("gridLayout") self.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(self) self.menubar.setGeometry(QRect(0, 0, 808, 25)) self.menubar.setObjectName("menubar") self.menuFile = QMenu(self.menubar) self.menuFile.setObjectName("menuFile") self.setMenuBar(self.menubar) self.statusbar = QStatusBar(self) self.statusbar.setObjectName("statusbar") self.setStatusBar(self.statusbar) self.actionQuit = QAction(self) self.actionQuit.setObjectName("actionQuit") self.menuFile.addSeparator() self.menuFile.addAction(self.actionQuit) self.menubar.addAction(self.menuFile.menuAction()) self.actionReset = QAction(self) self.actionReset.setObjectName("reset") self.menuFile.addSeparator() self.menuFile.addAction(self.actionReset) self.menubar.addAction(self.menuFile.menuAction()) # add other GUI objects self.graph_widget = GraphWidget(self.statusbar) self.gridLayout.addWidget(self.graph_widget, 1, 11, 10, 10 ) pixmap = QPixmap(':/images/cta-logo-mini.png') lbl = QLabel() lbl.setPixmap(pixmap) self.gridLayout.addWidget(lbl, 0, 0) p = self.graph_widget.palette() self.graph_widget.setAutoFillBackground(True) p.setColor( self.graph_widget.backgroundRole(),QColor(255,255,255))# QColor(226, 235, 252)) self.graph_widget.setPalette(p) self.quitButton = QPushButton() # self.centralwidget) self.quitButton.setObjectName("quitButton") self.quitButton.setText(QApplication.translate ("MainWindow", "Quit", None, QApplication.UnicodeUTF8)) self.gridLayout.addWidget(self.quitButton, 12, 0, 1, 1) self.info_label = InfoLabel(0,4) self.info_label.setAutoFillBackground(True) self.gridLayout.addWidget(self.info_label,1, 0, 1, 5) #self.info_label.setAlignment(PyQt4.Qt.AlignCenter); palette = QPalette() palette.setColor(self.info_label.backgroundRole(),Qt.lightGray) self.info_label.setPalette(palette) QObject.connect( self.quitButton, SIGNAL("clicked()"), self.stop) QObject.connect( self.actionQuit, SIGNAL("triggered()"), self.stop) QMetaObject.connectSlotsByName(self) self.retranslateUi() QObject.connect( self.actionQuit, SIGNAL("triggered()"), self.close) QMetaObject.connectSlotsByName(self) # Create GuiConnexion for ZMQ comminucation with pipeline self.guiconnection = GuiConnexion(gui_port=port, statusBar=self.statusbar) self.guiconnection.message.connect(self.graph_widget.pipechange) self.guiconnection.message.connect(self.info_label.pipechange) self.guiconnection.reset_message.connect(self.graph_widget.reset) self.guiconnection.reset_message.connect(self.info_label.reset) self.guiconnection.mode_message.connect(self.info_label.mode_receive) QObject.connect( self.actionReset, SIGNAL("triggered()"), self.guiconnection.reset) QMetaObject.connectSlotsByName(self) # start the process self.guiconnection.start()
def setup_ui(self, dock_widget): """ initiate main Qt building blocks of interface :param dock_widget: QDockWidget instance """ dock_widget.setObjectName("dock_widget") dock_widget.setAttribute(Qt.WA_DeleteOnClose) self.dock_widget_content = QWidget(self) self.dock_widget_content.setObjectName("dockWidgetContent") self.main_vlayout = QVBoxLayout(self) self.dock_widget_content.setLayout(self.main_vlayout) # add button to add objects to graphs self.button_bar_hlayout = QHBoxLayout(self) self.show_manual_input_button = QPushButton(self) self.button_bar_hlayout.addWidget(self.show_manual_input_button) self.show_manual_input_button.setDisabled(True) self.button_bar_hlayout.addWidget(QLabel("filter t/m categorie:")) self.category_combo = QComboBox(self) self.button_bar_hlayout.addWidget(self.category_combo) self.next_endpoint_button = QPushButton(self) self.button_bar_hlayout.addWidget(self.next_endpoint_button) self.next_endpoint_button.setDisabled(True) self.child_selection_strategy_combo = QComboBox(self) self.button_bar_hlayout.addWidget(QLabel("doortrekken tot:")) self.button_bar_hlayout.addWidget(self.child_selection_strategy_combo) spacer_item = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.button_bar_hlayout.addItem(spacer_item) # self.button_bar_hlayout.addItem(QLabel("doortrekken tot:")) # self.button_bar_hlayout.addItem(self.begroeiings_strategy_combo) self.main_vlayout.addLayout(self.button_bar_hlayout) # add tabWidget for graphWidgets self.contentLayout = QHBoxLayout(self) self.tree_table_tab = QTabWidget(self) sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.tree_table_tab.sizePolicy().hasHeightForWidth()) self.tree_table_tab.setSizePolicy(sizePolicy) self.tree_table_tab.setMinimumSize(QSize(850, 0)) self.contentLayout.addWidget(self.tree_table_tab) # startpointTree self.startpoint_tree_widget = StartpointTreeWidget(self, self.area_model) # sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) # sizePolicy.setHorizontalStretch(0) # sizePolicy.setVerticalStretch(0) # sizePolicy.setHeightForWidth( # self.legger_tree_widget.sizePolicy().hasHeightForWidth()) # self.legger_tree_widget.setSizePolicy(sizePolicy) # self.legger_tree_widget.setMinimumSize(QSize(750, 0)) self.tree_table_tab.addTab(self.startpoint_tree_widget, 'startpunten') # LeggerTree self.legger_tree_widget = LeggerTreeWidget(self, self.legger_model) # sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) # sizePolicy.setHorizontalStretch(0) # sizePolicy.setVerticalStretch(0) # sizePolicy.setHeightForWidth( # self.legger_tree_widget.sizePolicy().hasHeightForWidth()) # self.legger_tree_widget.setSizePolicy(sizePolicy) # self.legger_tree_widget.setMinimumSize(QSize(750, 0)) self.tree_table_tab.addTab(self.legger_tree_widget, 'hydrovakken') # graphs self.graph_vlayout = QVBoxLayout(self) # Graph self.plot_widget = LeggerPlotWidget( self, session=self.session, legger_model=self.legger_model, variant_model=self.variant_model) sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth( self.plot_widget.sizePolicy().hasHeightForWidth()) self.plot_widget.setSizePolicy(sizePolicy) self.plot_widget.setMinimumSize(QSize(250, 150)) self.graph_vlayout.addWidget(self.plot_widget, 2) # Sideview Graph self.sideview_widget = LeggerSideViewPlotWidget( self, session=self.session, legger_model=self.legger_model) sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(1) sizePolicy.setVerticalStretch(1) sizePolicy.setHeightForWidth( self.sideview_widget.sizePolicy().hasHeightForWidth()) self.sideview_widget.setSizePolicy(sizePolicy) self.sideview_widget.setMinimumSize(QSize(250, 150)) self.graph_vlayout.addWidget(self.sideview_widget) self.contentLayout.addLayout(self.graph_vlayout, 2) self.rightVstack = QVBoxLayout(self) sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) self.begroeiings_combo = QComboBox(self) self.begroeiings_strategy_combo = QComboBox(self) self.groupBox_begroeiings = QGroupBox(self) self.groupBox_begroeiings.setTitle("begroeiingsfilter en voor welk deel") vbox_strat = QVBoxLayout() vbox_strat.addWidget(self.begroeiings_combo) vbox_strat.addWidget(self.begroeiings_strategy_combo) self.groupBox_begroeiings.setLayout(vbox_strat) self.rightVstack.addWidget(self.groupBox_begroeiings) # variantentable self.plot_item_table = VariantenTable(self, variant_model=self.variant_model) self.plot_item_table.setMinimumWidth(380) self.rightVstack.addWidget(self.plot_item_table) self.selected_variant_remark = QPlainTextEdit(self) self.selected_variant_remark.setFixedHeight(100) self.selected_variant_remark.setDisabled(True) self.rightVstack.addWidget(self.selected_variant_remark) self.contentLayout.addLayout(self.rightVstack, 0) self.main_vlayout.addLayout(self.contentLayout) # add dockwidget dock_widget.setWidget(self.dock_widget_content) self.retranslate_ui(dock_widget) QMetaObject.connectSlotsByName(dock_widget)
# compiled functions as callables. from __future__ import print_function from PyQt4.QtCore import pyqtSlot, pyqtSignal, QObject, QMetaObject class Communicate(QObject): speak = pyqtSignal(int) def __init__(self, name="", parent=None): QObject.__init__(self, parent) self.setObjectName(name) class Speaker(QObject): @pyqtSlot(int) def on_communicator_speak(self, stuff): print(stuff) speaker = Speaker() someone = Communicate(name="communicator", parent=speaker) QMetaObject.connectSlotsByName(speaker) print("The answer is:", end="") # emit 'speak' signal someone.speak.emit(42) print("Slot should have made output by now.")
def setupUi(self): """create all other widgets we could make the scene view the central widget but I did not figure out how to correctly draw the background with QGraphicsView/QGraphicsScene. QGraphicsView.drawBackground always wants a pixmap for a huge rect like 4000x3000 where my screen only has 1920x1200""" # pylint: disable=R0915 self.setObjectName("MainWindow") centralWidget = QWidget() scene = MJScene() self.centralScene = scene self.centralView = FittingView() layout = QGridLayout(centralWidget) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self.centralView) self.tileset = None # just for pylint self.background = None # just for pylint self.tilesetName = Preferences.tilesetName self.windTileset = Tileset(Preferences.windTilesetName) self.discardBoard = DiscardBoard() self.discardBoard.setVisible(False) scene.addItem(self.discardBoard) self.selectorBoard = SelectorBoard() self.selectorBoard.setVisible(False) scene.addItem(self.selectorBoard) self.setCentralWidget(centralWidget) self.centralView.setScene(scene) self.centralView.setFocusPolicy(Qt.StrongFocus) self.adjustView() self.actionScoreGame = self.__kajonggAction("scoreGame", "draw-freehand", self.scoreGame, Qt.Key_C) self.actionPlayGame = self.__kajonggAction("play", "arrow-right", self.playGame, Qt.Key_N) self.actionAbortGame = self.__kajonggAction("abort", "dialog-close", self.abortAction, Qt.Key_W) self.actionAbortGame.setEnabled(False) self.actionQuit = self.__kajonggAction("quit", "application-exit", self.close, Qt.Key_Q) self.actionPlayers = self.__kajonggAction("players", "im-user", self.slotPlayers) self.actionRulesets = self.__kajonggAction("rulesets", "games-kajongg-law", self.slotRulesets) self.actionChat = self.__kajonggToggleAction("chat", "call-start", shortcut=Qt.Key_H, actionData=ChatWindow) game = self.game self.actionChat.setEnabled(bool(game) and bool(game.client) and not game.client.hasLocalServer()) self.actionChat.setChecked(bool(game) and bool(game.client) and bool(game.client.table.chatWindow)) self.actionScoring = self.__kajonggToggleAction("scoring", "draw-freehand", shortcut=Qt.Key_S, actionData=ScoringDialog) self.actionScoring.setEnabled(False) self.actionAngle = self.__kajonggAction("angle", "object-rotate-left", self.changeAngle, Qt.Key_G) self.actionAngle.setEnabled(False) self.actionFullscreen = KToggleFullScreenAction(self.actionCollection()) self.actionFullscreen.setShortcut(Qt.CTRL + Qt.Key_F) self.actionFullscreen.setShortcutContext(Qt.ApplicationShortcut) self.actionFullscreen.setWindow(self) self.actionCollection().addAction("fullscreen", self.actionFullscreen) self.actionFullscreen.toggled.connect(self.fullScreen) self.actionScoreTable = self.__kajonggToggleAction("scoreTable", "format-list-ordered", Qt.Key_T, actionData=ScoreTable) self.actionExplain = self.__kajonggToggleAction("explain", "applications-education", Qt.Key_E, actionData=ExplainView) self.actionAutoPlay = self.__kajonggAction("demoMode", "arrow-right-double", None, Qt.Key_D) self.actionAutoPlay.setCheckable(True) self.actionAutoPlay.toggled.connect(self.__toggleDemoMode) self.actionAutoPlay.setChecked(Internal.autoPlay) QMetaObject.connectSlotsByName(self)
def setupUi(self, port): self.setObjectName("MainWindow") self.resize(600, 600) self.centralwidget = QWidget(self) p = self.centralwidget.palette() self.centralwidget.setAutoFillBackground(True) p.setColor(self.centralwidget.backgroundRole(), QColor(126, 135, 152)) self.centralwidget.setPalette(p) self.centralwidget.setObjectName("centralwidget") self.gridLayout = QGridLayout(self.centralwidget) self.gridLayout.setObjectName("gridLayout") self.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(self) self.menubar.setGeometry(QRect(0, 0, 808, 25)) self.menubar.setObjectName("menubar") self.menuFile = QMenu(self.menubar) self.menuFile.setObjectName("menuFile") self.setMenuBar(self.menubar) self.statusbar = QStatusBar(self) self.statusbar.setObjectName("statusbar") self.setStatusBar(self.statusbar) self.actionQuit = QAction(self) self.actionQuit.setObjectName("actionQuit") self.menuFile.addSeparator() self.menuFile.addAction(self.actionQuit) self.menubar.addAction(self.menuFile.menuAction()) self.actionReset = QAction(self) self.actionReset.setObjectName("reset") self.menuFile.addSeparator() self.menuFile.addAction(self.actionReset) self.menubar.addAction(self.menuFile.menuAction()) # add other GUI objects self.graph_widget = GraphWidget(self.statusbar) self.gridLayout.addWidget(self.graph_widget, 1, 11, 10, 10) pixmap = QPixmap(':/images/cta-logo-mini.png') lbl = QLabel() lbl.setPixmap(pixmap) self.gridLayout.addWidget(lbl, 0, 0) p = self.graph_widget.palette() self.graph_widget.setAutoFillBackground(True) p.setColor(self.graph_widget.backgroundRole(), QColor(255, 255, 255)) # QColor(226, 235, 252)) self.graph_widget.setPalette(p) self.quitButton = QPushButton() # self.centralwidget) self.quitButton.setObjectName("quitButton") self.quitButton.setText( QApplication.translate("MainWindow", "Quit", None, QApplication.UnicodeUTF8)) self.gridLayout.addWidget(self.quitButton, 12, 0, 1, 1) self.info_label = InfoLabel(0, 4) self.info_label.setAutoFillBackground(True) self.gridLayout.addWidget(self.info_label, 1, 0, 1, 5) #self.info_label.setAlignment(PyQt4.Qt.AlignCenter); palette = QPalette() palette.setColor(self.info_label.backgroundRole(), Qt.lightGray) self.info_label.setPalette(palette) QObject.connect(self.quitButton, SIGNAL("clicked()"), self.stop) QObject.connect(self.actionQuit, SIGNAL("triggered()"), self.stop) QMetaObject.connectSlotsByName(self) self.retranslateUi() QObject.connect(self.actionQuit, SIGNAL("triggered()"), self.close) QMetaObject.connectSlotsByName(self) # Create GuiConnexion for ZMQ comminucation with pipeline self.guiconnection = GuiConnexion(gui_port=port, statusBar=self.statusbar) self.guiconnection.message.connect(self.graph_widget.pipechange) self.guiconnection.message.connect(self.info_label.pipechange) self.guiconnection.reset_message.connect(self.graph_widget.reset) self.guiconnection.reset_message.connect(self.info_label.reset) self.guiconnection.mode_message.connect(self.info_label.mode_receive) QObject.connect(self.actionReset, SIGNAL("triggered()"), self.guiconnection.reset) QMetaObject.connectSlotsByName(self) # start the process self.guiconnection.start()
# limitations under the License. # # This test is using signals and will only work if PySide properly accepts # compiled functions as callables. from __future__ import print_function from PyQt4.QtCore import pyqtSlot, pyqtSignal, QObject, QMetaObject class Communicate(QObject): speak = pyqtSignal(int) def __init__(self,name = "",parent = None): QObject.__init__(self,parent) self.setObjectName(name) class Speaker(QObject): @pyqtSlot(int) def on_communicator_speak(self, stuff): print(stuff) speaker = Speaker() someone = Communicate(name = "communicator",parent = speaker) QMetaObject.connectSlotsByName(speaker) print("The answer is:",end = "") # emit 'speak' signal someone.speak.emit(42) print("Slot should have made output by now.")
def setupUi (self, Form): font = QFont () font.setPointSize (9) font.setBold (False) font.setWeight (50) sizePolicy = QSizePolicy (QSizePolicy.Fixed, QSizePolicy.Fixed) sizePolicy.setHorizontalStretch (0) sizePolicy.setVerticalStretch (0) Form.setObjectName (_fromUtf8("Form")) Form.resize (971, 930) self.plainTextEdit = QPlainTextEdit (Form) self.plainTextEdit.setGeometry (QRect (740, 280, 221, 611)) self.plainTextEdit.setObjectName (_fromUtf8 ("plainTextEdit")) self.plainTextEdit.setFont (font) self.widget = OGLViewer (Form) self.widget.setUi_Form (self) self.widget.setGeometry (QRect (10, 10, 720, 450)) sizePolicy.setHeightForWidth (self.widget.sizePolicy().hasHeightForWidth()) self.widget.setSizePolicy (sizePolicy) self.widget.setObjectName (_fromUtf8 ("widget")) self.wireOGLViewerUp () self.wireEngineUp () self.label_view = QLabel (Form) self.label_view.setGeometry (QRect (10, 470, 720, 450)) sizePolicy.setHeightForWidth (self.label_view.sizePolicy().hasHeightForWidth()) self.label_view.setSizePolicy (sizePolicy) self.label_view.setObjectName (_fromUtf8 ("label_view")) self.initLabel () self.pixmap_item = self.label_view.setPixmap (QPixmap.fromImage (self.image)) # buttons definitions self.renderBtn = QPushButton (Form) self.pauseBtn = QPushButton (Form) self.stopBtn = QPushButton (Form) self.upBtn = QPushButton (Form) self.downBtn = QPushButton (Form) self.moreDownBtn = QPushButton (Form) self.moreUpBtn = QPushButton (Form) self.rightBtn = QPushButton (Form) self.moreRightBtn = QPushButton (Form) self.leftBtn = QPushButton (Form) self.furtherLeft = QPushButton (Form) self.grid_switch = QPushButton (Form) buttons_properties_list = [[self.renderBtn, True, QRect (740, 140, 61, 21), "render"], [self.pauseBtn, False, QRect (740, 120, 61, 21), "pause"], [self.stopBtn, False, QRect (740, 100, 61, 21), "stop"], [self.upBtn, False, QRect (820, 120, 21, 21), "one_row_up"], [self.downBtn, False, QRect (820, 140, 21, 21), "one_row_down"], [self.moreDownBtn, False, QRect (820, 160, 21, 21), "ten_rows_down"], [self.moreUpBtn, False, QRect (820, 100, 21, 21), "ten_rows_up"], [self.rightBtn, False, QRect (780, 180, 21, 21), "one_column_right"], [self.moreRightBtn, False, QRect (800, 180, 21, 21), "ten_columns_right"], [self.leftBtn, False, QRect (760, 180, 21, 21), "one_column_left"], [self.furtherLeft, False, QRect (740, 180, 21, 21), "ten_columns_left"], [self.grid_switch, False, QRect (870, 230, 91, 31), "grid_switch"]] for button in buttons_properties_list: button[0].setEnabled (button[1]) button[0].setGeometry (button[2]) button[0].setFont (font) button[0].setObjectName (_fromUtf8 (button[3])) # other UI elements self.progressBar = QProgressBar (Form) self.progressBar.setGeometry (QRect (740, 901, 221, 20)) self.progressBar.setProperty ("value", 0) self.progressBar.setObjectName (_fromUtf8("progressBar")) self.progressBar.setMinimum (0) self.progressBar.setMaximum (100) self.slider_label = QLabel (Form) self.slider_label.setGeometry (QRect(900, 260, 61, 16)) self.slider_label.setFont(font) self.slider_label.setObjectName (_fromUtf8("slider_label")) self.slider_label.setEnabled (True) self.arrowSizeSlider = QSlider (Form) self.arrowSizeSlider.setGeometry (QRect (740, 258, 151, 22)) self.arrowSizeSlider.setMinimum (2) self.arrowSizeSlider.setMaximum (40) self.arrowSizeSlider.setSingleStep (1) self.arrowSizeSlider.setProperty ("value", 4) self.arrowSizeSlider.setOrientation (Qt.Horizontal) self.arrowSizeSlider.setObjectName (_fromUtf8("arrowSizeSlider")) self.retranslateUi (Form) QMetaObject.connectSlotsByName (Form)
def __setup_gui__(self, Dialog): global f f = open(filename, "a") f.write("Setup of gui.\n") f.close() Dialog.setObjectName("Dialog") Dialog.resize(270, 145) self.setWindowTitle("Map Layer") screen = QDesktopWidget().screenGeometry() size = self.geometry() self.move((screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2) self.Render = QPushButton("Render", Dialog) self.Render.setGeometry(QRect(85, 90, 100, 25)) self.Render.setObjectName("Render") self.comboBox = QComboBox(Dialog) self.comboBox.setGeometry(QRect(100, 34, 115, 18)) self.comboBox.setEditable(False) self.comboBox.setMaxVisibleItems(11) self.comboBox.setInsertPolicy(QComboBox.InsertAtBottom) self.comboBox.setObjectName("comboBox") self.comboBox.addItems([ "Google Roadmap", "Google Terrain", "Google Satellite", "Google Hybrid", "Yahoo Roadmap", "Yahoo Satellite", "Yahoo Hybrid", "Bing Roadmap", "Bing Satellite", "Bing Hybrid", "Open Street Maps" ]) self.comboBox.setCurrentIndex(10) self.label1 = QLabel("Source:", Dialog) self.label1.setGeometry(QRect(55, 35, 35, 16)) self.label1.setObjectName("label1") self.slider = QSlider(Dialog) self.slider.setOrientation(Qt.Horizontal) self.slider.setMinimum(1) self.slider.setMaximum(12) self.slider.setValue(4) self.slider.setGeometry(QRect(110, 61, 114, 16)) self.label2 = QLabel("Quality: " + str(self.slider.value()), Dialog) self.label2.setGeometry(QRect(47, 61, 54, 16)) self.label2.setObjectName("label2") self.doubleSpinBox = QDoubleSpinBox(Dialog) self.doubleSpinBox.setGeometry(QRect(160, 5, 40, 20)) self.doubleSpinBox.setDecimals(0) self.doubleSpinBox.setObjectName("doubleSpinBox") self.doubleSpinBox.setMinimum(10.0) self.doubleSpinBox.setValue(20.0) self.doubleSpinBox.setEnabled(False) self.checkBox = QCheckBox("Auto refresh", Dialog) self.checkBox.setGeometry(QRect(50, 6, 100, 20)) self.checkBox.setLayoutDirection(Qt.RightToLeft) self.checkBox.setObjectName("checkBox") self.progressBar = QProgressBar(Dialog) self.progressBar.setGeometry(QRect(5, 130, 260, 10)) self.progressBar.setProperty("value", 0) self.progressBar.setTextVisible(False) self.progressBar.setObjectName("progressBar") self.progressBar.setVisible(False) QObject.connect(self.Render, SIGNAL("clicked()"), Dialog.__repaint__) QMetaObject.connectSlotsByName(Dialog) QObject.connect(self.slider, SIGNAL("valueChanged(int)"), self.__update_slider_label__) QObject.connect(self.comboBox, SIGNAL("activated(int)"), self.__combobox_changed__) self.timerRepaint = QTimer() QObject.connect(self.checkBox, SIGNAL("clicked()"), self.__activate_timer__) QObject.connect(self.timerRepaint, SIGNAL("timeout()"), self.__on_timer__) f = open(filename, "a") f.write("End of setup of gui.\n") f.close()