def __init__(self, parent=None): super(MyMainWindow, self).__init__(parent) # the GUI is loaded here self.ui = None if 'QUiLoader' in globals(): # PySide self.ui = loadUi(UI_FILE, self) if 'uic' in globals(): # PyQt ui_class, widget_class = uic.loadUiType(UI_FILE) self.ui = ui_class() self.ui.setupUi(self) # read from a config file our key and other settings... self.settings = QtCore.QSettings('./telesocial-gui.ini', QtCore.QSettings.IniFormat) # get the API/APP key. If none set, use the default appkey = str(self.settings.value('appkey', APP_KEY).toString().toAscii()) self.show() # telesocial client object self.client = telesocial.SimpleClient(appkey)
def loadUiType(filename, themed=True): ''' Loads and compiles a Qt Ui file via uic, and returns the Type and Basetype as a tuple Looks in theme directories first. Nonthemed means the file can come from anywhere. ''' if themed: if __themedir and os.path.isfile(os.path.join(__themedir, filename)): return uic.loadUiType(os.path.join(__themedir, filename)) else: return uic.loadUiType(os.path.join(COMMON_DIR, filename)) else: return uic.loadUiType(filename) #Unthemed means this can come from any location
def __init__(self, featureDict, selectedFeatures=None, parent=None, ndim=3): """ Parameters: * featureDict: a nested dictionary. {plugin name : {feature name : {parameter name : parameter}} * selectedDict: like featureDict. entries will be checked and their parameters populated. """ QDialog.__init__(self, parent) self.featureDict = featureDict if selectedFeatures is None or len(selectedFeatures) == 0: selectedFeatures = defaultdict(list) self.selectedFeatures = selectedFeatures self.setWindowTitle("Object Features") ui_class, widget_class = uic.loadUiType(os.path.split(__file__)[0] + "/featureSelection.ui") self.ui = ui_class() self.ui.setupUi(self) self.ui.buttonBox.accepted.connect(self.accept) self.ui.buttonBox.rejected.connect(self.reject) self.ui.allButton.pressed.connect(self.handleAll) self.ui.noneButton.pressed.connect(self.handleNone) self.populate() self.ndim = ndim self.set_margin() self.setObjectName("FeatureSelectionDialog")
def __init__(self, parent, data, item, mode, package): QtGui.QWidget.__init__(self, parent) self.item = item self.data = data self.mode = mode ui_class, widget_class = uic.loadUiType(package.filePath('ui', 'sourceitem.ui')) self.ui = ui_class() self.ui.setupUi(self) if self.mode == AVAILABLE: name = "[%s] %s" % (self.data[0], self.data[2]) self.url = "%s/%s" % (REPO_BASE, self.data[1]) self.ui.buttonRemove.hide() self.ui.buttonApply.setIcon(KIcon("go-down")) self.ui.buttonApply.setToolTip("Download Source") else: #name = "[%s] %s" % (self.data[0], self.data[2]) name = self.data[2] self.url = package.filePath('data', self.data[1]) self.ui.buttonRemove.setIcon(KIcon("list-remove")) self.ui.buttonRemove.setToolTip("Remove Source") self.ui.buttonApply.setToolTip("Select Source") self.ui.labelName.setText(name)
def __init__(self, parent=None): QWidget.__init__(self, parent) self.ui = uic.loadUiType('main.ui')[0]() self.ui.setupUi(self) self.localize() self.ui.config.setup(self.ui.terminals, self.ui.payments) self.ui.terminals.ready.connect(self.ui.config.terminals_ready) self.ui.config.terminals_changed.connect(self.ui.terminals.update_model) self.ui.config.terminals_changed.connect(self.enable_buttons) self.ui.payments.session_started.connect(self.session_start) self.ui.payments.session_ended.connect(self.session_end) self.db = LocalDB() self.left_terminals = [] self.right_terminals = [] self.ui.leftUp.clicked.connect(self.left_up) self.ui.leftDown.clicked.connect(self.left_down) self.ui.rightUp.clicked.connect(self.right_up) self.ui.rightDown.clicked.connect(self.right_down) self.ui.payments.new_payment.connect(lambda: self.ui.tabs.setCurrentIndex(1)) self.session_end()
def __init__(self, _default_adr): # some defaults self.adr_server_name = "adr_server" self.adr_server_not_found_message = 'Server "%s" not found!' % self.adr_server_name self.peripheral_orphaned_message = "Orphaned" self.peripheral_no_adr_message = "" self.default_adr = _default_adr # initialize misc self.cxn = None self.adr_server = None cxn_def = labrad.wrappers.connectAsync(name=labrad.util.getNodeName() + " ADR GUI") cxn_def.addCallback(self.set_cxn) self.waitingOnLabRAD = True # initialize the qt side of things QtGui.QMainWindow.__init__(self) ui_class, widget_class = uic.loadUiType("ADRcontrol.ui") self.ui = ui_class() self.ui.setupUi(self) self.setWindowTitle("ADR controls") self.setWindowIcon(QtGui.QIcon("ADR.png")) self.show() self.ui_init() # list of all the items that get disabled when in read-only mode self.protected = [ self.ui.refreshPeripherals_button, self.ui.refreshGPIB_button, self.ui.refreshDefaults_button, self.ui.status_menu, self.ui.compressorStart_pushButton, self.ui.compressorStop_pushButton, self.ui.closeHeatSwitch, self.ui.openHeatSwitch, self.ui.quenchLimit_button, self.ui.cooldownLimit_button, self.ui.rampWaitTime_button, self.ui.voltageStepDown_button, self.ui.voltageStepUp_button, self.ui.voltageLimit_button, self.ui.maxCurrent_button, self.ui.targetCurrent_button, self.ui.ruoxTempCutoff_button, self.ui.lockinOhmsPerVolt_button, self.ui.autoControl, self.ui.delayHeatSwitchClose, self.ui.schedulingActive, self.ui.scheduledMagUpTime, self.ui.tempRecordDelay_button, self.ui.fieldWaitTime_button, self.ui.autoRecord, self.ui.recordingTemp_button, self.ui.loggingStart_pushButton, self.ui.loggingStop_pushButton, self.ui.loggingReset_pushButton, ] # oh yeah self.ui.statusbar.showMessage("oh yeah")
def __init__(self): QtGui.QMainWindow.__init__(self) ui_class, widget_class = uic.loadUiType("wireedit.ui") self.ui = ui_class() self.ui.setupUi(self) self.loadKey('wiring') self.show()
def test_qt_designer(): """Embed Canvas via Qt Designer""" from PyQt4 import QtGui, uic app = QtGui.QApplication.instance() if app is None: app = QtGui.QApplication([]) fname = op.join(op.dirname(__file__), 'qt-designer.ui') with warnings.catch_warnings(record=True): # pyqt4 deprecation warning WindowTemplate, TemplateBaseClass = uic.loadUiType(fname) class MainWindow(TemplateBaseClass): def __init__(self): TemplateBaseClass.__init__(self) self.ui = WindowTemplate() self.ui.setupUi(self) win = MainWindow() try: canvas = win.ui.canvas # test we can access properties of the internal canvas: canvas.central_widget.add_view() win.show() app.processEvents() finally: win.close() return win
def __init__(self, featureDict, selectedFeatures=None, parent=None): QDialog.__init__(self, parent) self.featureDict = featureDict if selectedFeatures is None or len(selectedFeatures) == 0: selectedFeatures = defaultdict(list) self.selectedFeatures = selectedFeatures self.setWindowTitle("Object Features") ui_class, widget_class = uic.loadUiType(os.path.split(__file__)[0] + "/featureSelection.ui") self.ui = ui_class() self.ui.setupUi(self) self.ui.buttonBox.accepted.connect(self.accept) self.ui.buttonBox.rejected.connect(self.reject) self.ui.allButton.pressed.connect(self.handleAll) self.ui.noneButton.pressed.connect(self.handleNone) self.ui.treeWidget.setColumnCount(1) for pluginName, features in featureDict.iteritems(): parent = QTreeWidgetItem(self.ui.treeWidget) parent.setText(0, pluginName) parent.setExpanded(True) for name in sorted(features): item = QTreeWidgetItem(parent) item.setText(0, name) item.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled) if pluginName in self.selectedFeatures: if name in self.selectedFeatures[pluginName]: item.setCheckState(0, Qt.Checked) else: item.setCheckState(0, Qt.Unchecked)
def __init__(self, dimensions, feature_table, req_features=None, selected_features=None, title=None, parent=None, filename=None): super(ExportObjectInfoDialog, self).__init__(parent) ui_class, widget_class = uic.loadUiType(os.path.split(__file__)[0] + "/exportObjectInfoDialog.ui") self.ui = ui_class() self.ui.setupUi(self) self.setWindowTitle(title) self.raw_size = reduce(mul, dimensions, 1) if req_features is None: req_features = [] req_features.extend(DEFAULT_REQUIRED_FEATURES) if selected_features is None: selected_features = [] self._setup_features(feature_table, req_features, selected_features) self.ui.featureView.setHeaderLabels(("Select Features",)) self.ui.featureView.expandAll() if filename is not None and self.is_valid_path(filename): self.ui.exportPath.setText(filename) self.ui.fileFormat.setCurrentIndex(self._get_file_type_index_from_filename(filename)) else: self.ui.exportPath.setText(os.path.expanduser("~") + "/exported_data.h5") self.ui.exportPath.dropEvent = self._drop_event # self.ui.forceUniqueIds.setEnabled(dimensions[0] > 1) self.ui.compressFrame.setVisible(False)
def shapes_clicked(self): shape = uic.loadUiType("cal.ui")[0] class calc(QtGui.QDialog, shape): def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) self.setupUi(self) self.oval.setStyleSheet("background-image: url(images/shapes/oval.png);") self.line.setStyleSheet("background-image: url(images/shapes/line.jpg);") self.curve.setStyleSheet("background-image: url(images/shapes/curve.jpg);") self.rectangle.setStyleSheet("background-image: url(images/shapes/rectangle.png);") self.roundedrectangle.setStyleSheet("background-image: url(images/shapes/roundedrectangle.png);") self.polygon.setStyleSheet("background-image: url(images/shapes/polygon.png);") self.triangle.setStyleSheet("background-image: url(images/shapes/triangle.png);") self.rttriangle.setStyleSheet("background-image: url(images/shapes/rttriangle.png);") self.diamond.setStyleSheet("background-image: url(images/shapes/diamond.png);") self.pentagon.setStyleSheet("background-image: url(images/shapes/pentagon.png);") self.hexagon.setStyleSheet("background-image: url(images/shapes/hexagon.jpg);") self.rtarrow.setStyleSheet("background-image: url(images/shapes/rtarrow.png);") self.ltarrow.setStyleSheet("background-image: url(images/shapes/ltarrow.png);") self.uparrow.setStyleSheet("background-image: url(images/shapes/uparrow.png);") self.downarrow.setStyleSheet("background-image: url(images/shapes/downarrow.png);") self.pt4star.setStyleSheet("background-image: url(images/shapes/pt4star.png);") self.pt5star.setStyleSheet("background-image: url(images/shapes/pt5star.png);") self.pt6star.setStyleSheet("background-image: url(images/shapes/pt6star.png);") self.rectcallout.setStyleSheet("background-image: url(images/shapes/rectcallout.png);") self.ovalcallout.setStyleSheet("background-image: url(images/shapes/ovalcallout.png);") self.cloudcallout.setStyleSheet("background-image: url(images/shapes/cloudcallout.png);") self.heart.setStyleSheet("background-image: url(images/shapes/heart.png);") self.lightening.setStyleSheet("background-image: url(images/shapes/lightening.jpg);") self.size() calc = calc(None) calc.show() calc.exec_()
def __init__(self, parent_widget, db): self.ui = uic.loadUiType("Курс.ui")[0]() self.ui.setupUi(parent_widget) self.db = db self.update() #вивід кореневої теки, де будемо шукати файли, які будемо копіювати filesModel = QtGui.QFileSystemModel() self.ui.sourcepathView.setModel(filesModel) self.ui.sourcepathView.setRootIndex(filesModel.setRootPath(self.files_path)) #вивід теки призначення (на сервері) serverpathModel = QtGui.QFileSystemModel() self.ui.serverpathView.setModel(serverpathModel) #self.ui.serverpathView.setColumnWidth(0,200) self.ui.serverpathView.setRootIndex(serverpathModel.setRootPath(self.serverpath)) #методи драп унд дроп self.ui.serverpathView.__class__.dragEnterEvent = self.EnterEvent self.ui.serverpathView.__class__.dropEvent = self.DropEvent self.ui.serverpathView.__class__.dragMoveEvent = self.MoveEvent self.ui.pushButtonSwitchId.clicked.connect(self.change_course_context)
def __init__(self, parent=None): super(ZMQPublisherInfoWidget, self).__init__(parent) ui_class, widget_class = uic.loadUiType(os.path.split(__file__)[0] + "/zmqPubSubInfoWidget.ui") self.ui = ui_class() self.ui.setupUi(self) self.status = { "pub": { "address": None, "running": False }, "sub": { "address": None, "running": False } } self.ui.toggleSubStatus.clicked.connect(partial(self.ui.toggleSubStatus.setEnabled, False)) self.ui.togglePubStatus.clicked.connect(partial(self.ui.togglePubStatus.setEnabled, False)) self.ui.toggleSubStatus.clicked.connect(self.subStatusToggled.emit) self.ui.togglePubStatus.clicked.connect(self.pubStatusToggled.emit) menu = QMenu("options") self.change_pub_addr_action = menu.addAction("Change Address", self.changePubAddress.emit) self.ui.togglePubStatus.setMenu(menu) menu = QMenu("options") self.change_sub_addr_action = menu.addAction("Change Address", self.changeSubAddress.emit) self.ui.toggleSubStatus.setMenu(menu) self.status_style = "background-color: %s; border: 3px inset gray; padding: 5px"
def __init__(self): QtGui.QMainWindow.__init__(self) self.gra = Gra.instance() #w ten sposób ten kod uruchomi się także pod Python Portable, gdzie #nie ma uic. global got_uic if got_uic: Ui_MainWindow = uic.loadUiType("ui/mainwindow.ui")[0] self.ui = Ui_MainWindow() else: self.ui = mainwindow.Ui_MainWindow() self.ui.setupUi(self) self.timer = QtCore.QTimer() self.ui.nrTuryLbl.connect(self.timer, QtCore.SIGNAL('timeout()'), self.odswiez_ekran) self.timer.start(1000) self.tryb_przyciskow = None self.ruch_z = None self.stworz_przyciski() self.ui.podlaczSieBtn.clicked.connect(lambda: self.podlacz_sie()) self.ui.nowaTuraBtn.clicked.connect(lambda: self.gra.nowa_tura()) self.ui.przelejPunktyBtn.clicked.connect(self.przelej_punkty) self.ui.zabierzPunktyBtn.clicked.connect(self.zabierz_punkty) self.ui.kupJednostkeBtn.clicked.connect(self.kup_jednostke)
def test_qt_designer(): """Embed Canvas via Qt Designer""" if not test_uic: return path = os.path.dirname(__file__) WindowTemplate, TemplateBaseClass = uic.loadUiType(os.path.join(path, 'qt-designer.ui')) class MainWindow(TemplateBaseClass): def __init__(self): TemplateBaseClass.__init__(self) self.ui = WindowTemplate() self.ui.setupUi(self) self.show() global win win = MainWindow() win.show() canvas = Canvas(native=win.ui.canvas) @canvas.events.paint.connect def on_paint(ev): gl.glClearColor(0.0, 0.0, 0.0, 0.0) gl.glClear(gl.GL_COLOR_BUFFER_BIT) canvas.swap_buffers()
def __init__(self, owner): self.owner = owner QtGui.QWidget.__init__(self) uiPath = g.os_path_join(g.app.leoDir, 'plugins', 'Backlink.ui') form_class, base_class = uic.loadUiType(uiPath) self.owner.c.frame.log.createTab('Links', widget = self) self.UI = form_class() self.UI.setupUi(self) u = self.UI o = self.owner self.connect(u.markBtn, QtCore.SIGNAL("clicked()"), o.mark) self.connect(u.swapBtn, QtCore.SIGNAL("clicked()"), o.swap) self.connect(u.linkBtn, QtCore.SIGNAL("clicked()"), self.linkClicked) self.connect(u.rescanBtn, QtCore.SIGNAL("clicked()"), o.loadLinksInt) self.connect(u.dirLeftBtn, QtCore.SIGNAL("clicked()"), self.dirClicked) self.connect(u.dirRightBtn, QtCore.SIGNAL("clicked()"), self.dirClicked) self.connect(u.linkList, QtCore.SIGNAL("itemClicked(QListWidgetItem*)"), self.listClicked) self.connect(u.deleteBtn, QtCore.SIGNAL("stateChanged(int)"), o.deleteSet)
def __init__(self): addr = 'logs/{}{}'.format(str(date.today())[:-7], '(de<en)crypt.log') logging.basicConfig(filename=addr, level=logging.ERROR) super(QMainWindow, self).__init__() ui, cls = uic.loadUiType('ui/main.ui') del cls self.ui = ui() self.ui.setupUi(self) self.setWindowIcon(QIcon('ui/main.png')) self.ui.view_e.setCheckable(True) self.ui.view_e.setIcon(QIcon('ui/on.png')) self.ui.view_d.setCheckable(True) self.ui.view_d.setIcon(QIcon('ui/on.png')) self.ui.enc_bar.setMinimum(0) self.ui.dec_bar.setMinimum(0) self.ui.enc_bar.setValue(0) self.ui.dec_bar.setValue(0) # some variables self.f_dlg = QFileDialog(self) self.set_directory() self.clipboard = QApplication.clipboard() # connects self.ui.open_encrypt.clicked.connect(self.opn_f_enc) self.ui.open_decrypt.clicked.connect(self.opn_f_dec) self.ui.open_to_encrypt.clicked.connect(self.opn_f_to_enc) self.ui.open_to_decrypt.clicked.connect(self.opn_f_to_dec) self.ui.view_e.clicked.connect(self.view_pwd_e) self.ui.view_d.clicked.connect(self.view_pwd_d) self.ui.encrypt_text.clicked.connect(self.btn_encrypt_text) self.ui.decrypt_text.clicked.connect(self.btn_decrypt_text) self.ui.encrypt_file.clicked.connect(self.btn_encrypt_file) self.ui.decrypt_file.clicked.connect(self.btn_decrypt_file) self.ui.copy_enc.clicked.connect(self.copy_encrypted_text) self.ui.copy_dec.clicked.connect(self.copy_decrypted_text)
def test_qt_designer(): """Embed Canvas via Qt Designer""" default_app.use() if 'pyqt4' not in default_app.backend_name.lower(): raise SkipTest('Not using PyQt4 backend') # wrong backend from PyQt4 import uic fname = op.join(op.dirname(__file__), 'qt-designer.ui') WindowTemplate, TemplateBaseClass = uic.loadUiType(fname) default_app.create() # make sure we have an app, or the init will fail class MainWindow(TemplateBaseClass): def __init__(self): TemplateBaseClass.__init__(self) self.ui = WindowTemplate() self.ui.setupUi(self) self.show() win = MainWindow() try: win.show() canvas = Canvas(create_native=False) canvas.app.use() # Make sure the app exists (because create_native=0) canvas._set_backend(win.ui.canvas) canvas.create_native() @canvas.events.draw.connect def on_draw(ev): gl.glClearColor(0.0, 0.0, 0.0, 0.0) gl.glClear(gl.GL_COLOR_BUFFER_BIT) canvas.swap_buffers() finally: win.close()
def test_qt_designer(): """Embed Canvas via Qt Designer""" from PyQt4 import QtGui, uic if not QtGui.QApplication.instance(): QtGui.QApplication([]) # noqa fname = op.join(op.dirname(__file__), 'qt-designer.ui') WindowTemplate, TemplateBaseClass = uic.loadUiType(fname) class MainWindow(TemplateBaseClass): def __init__(self): TemplateBaseClass.__init__(self) self.ui = WindowTemplate() self.ui.setupUi(self) self.show() win = MainWindow() try: win.show() canvas = Canvas(create_native=False) canvas._set_backend(win.ui.canvas) canvas.create_native() @canvas.events.paint.connect def on_paint(ev): gl.glClearColor(0.0, 0.0, 0.0, 0.0) gl.glClear(gl.GL_COLOR_BUFFER_BIT) canvas.swap_buffers() finally: win.close()
def __init__(self, parent = None): QtGui.QWidget.__init__(self, parent) Form, Base = uic.loadUiType("createScriptForm.ui") self.ui = Form() self.ui.setupUi(self) self.setWindowModality(QtCore.Qt.WindowModal) self.connect(self.ui.pBCancel, QtCore.SIGNAL("clicked()"), self.on_close)
def __init__(self,object): # the panel has a tree widget that contains categories # for the subcomponents, such as additions, subtractions. # the categories are shown only if they are not empty. form_class, base_class = uic.loadUiType(FreeCAD.getHomePath() + "Mod/Fem/ShowDisplacement.ui") self.obj = object self.formUi = form_class() self.form = QtGui.QWidget() self.formUi.setupUi(self.form) #Connect Signals and Slots QtCore.QObject.connect(self.formUi.radioButton_Displacement, QtCore.SIGNAL("clicked(bool)"), self.displacementClicked) QtCore.QObject.connect(self.formUi.radioButton_Stress, QtCore.SIGNAL("clicked(bool)"), self.stressClicked) QtCore.QObject.connect(self.formUi.radioButton_NoColor, QtCore.SIGNAL("clicked(bool)"), self.noColorClicked) QtCore.QObject.connect(self.formUi.checkBox_ShowDisplacement, QtCore.SIGNAL("clicked(bool)"), self.showDisplacementClicked) QtCore.QObject.connect(self.formUi.verticalScrollBar_Factor, QtCore.SIGNAL("valueChanged(int)"), self.sliderValue) QtCore.QObject.connect(self.formUi.spinBox_SliderFactor, QtCore.SIGNAL("valueChanged(double)"), self.sliderMaxValue) QtCore.QObject.connect(self.formUi.spinBox_DisplacementFactor, QtCore.SIGNAL("valueChanged(double)"), self.displacementFactorValue) self.DisplacementObject = None self.StressObject = None self.update()
def __init__(self, applet): super(QDialog,self).__init__() path = applet.package().path() + "ui/loan_add.ui" addDlg, baseClass = uic.loadUiType(path) self.realDlg = addDlg() self.realDlg.setupUi(self) # convenience access to widget we care about for obj in ['lineItemDescription','linePerson', 'dteDate', 'dteExpectedDate', 'comboItemType']: self.__dict__[obj] = self.realDlg.__dict__[obj] # init combobox self.comboItemType.insertItems(0, list_to_stringlist(applet.db.get_loan_types())) self.comboItemType.clearEditText() # init dates today = datetime.today() self.dteDate.setDateTime(today) self.dteExpectedDate.setDateTime(today) # signals self.realDlg.buttonBox.accepted.connect(self.add) self.show()
def loadUiType(ui_file): from wishlib.qt import active, QtGui if active == "PySide": import pysideuic parsed = xml.parse(ui_file) widget_class = parsed.find('widget').get('class') form_class = parsed.find('class').text with open(ui_file, 'r') as f: o = StringIO() frame = {} pysideuic.compileUi(f, o, indent=0) pyc = compile(o.getvalue(), '<string>', 'exec') exec pyc in frame # Fetch the base_class and form class based on their type in the # xml from designer form_class = frame['Ui_%s' % form_class] # base_class = eval('QtGui.%s' % widget_class) base_class = getattr(QtGui, widget_class) return form_class, base_class elif active == "PyQt4": from PyQt4 import uic return uic.loadUiType(ui_file) return None
def __init__(self, parent=None): QWidget.__init__(self, parent) self.ui = uic.loadUiType('config.ui')[0]() self.ui.setupUi(self) self.localize() self.terminals = None self.payment = None self.terminal_config = None self.flick = FlickCharm() self.flick.activate_on(self.ui.terminalsScrollArea) self.flick.activate_on(self.ui.generalScrollArea) self.ui.version.setText(stoppark.__version__) self.get_time() self.ui.updateVersion.setVisible(False) self.ui.setupTerminals.clicked.connect(self.setup_terminals) self.ui.updateTerminals.clicked.connect(self.begin_terminal_update) self.wicd = None self.ui.setupNetworkConnection.clicked.connect(self.setup_network_connection) self.ui.apbState.stateChanged.connect(lambda state: self.option_changed.emit('apb', str(state))) self.ui.manualTicketPrint.stateChanged.connect(lambda state: self.option_changed.emit('ticket.manual_print', str(state)))
def __init__(self, rawImageLayer, objectImageLayer, featureTableNames, imagePerObject=True, \ imagePerTime = True, parent=None): QDialog.__init__(self, parent) self.setWindowTitle("Export to Knime") ui_class, widget_class = uic.loadUiType(os.path.split(__file__)[0] + "/exportToKnimeDialog.ui") self.ui = ui_class() self.ui.setupUi(self) itemRaw = QListWidgetItem(rawImageLayer.name) self.ui.rawList.addItem(itemRaw) itemObjects = QListWidgetItem(objectImageLayer.name) self.ui.objectList.addItem(itemObjects) self.imagePerObject = imagePerObject self.imagePerTime = imagePerTime #FIXME: assume for now tht the feature table is a dict try: for plugin, feature_dict in featureTableNames.iteritems(): print plugin for feature_name in feature_dict.keys(): print "adding feature:", feature_name item = QListWidgetItem(feature_name) item.setFlags(item.flags() | Qt.ItemIsUserCheckable) item.setCheckState(Qt.Unchecked) self.ui.featureList.addItem(item) except: print "hahaha, doesn't work!"
def __init__(self): self.app = QtGui.QApplication(sys.argv) uiClass, MainWindowClass = uic.loadUiType("Диспетчер.ui") self.ui=uiClass() self.mw=MainWindowClass() self.ui.setupUi(self.mw) #ui.horizontalLayout.addWidget(MyStaticMplCanvas(ui.tab, width=6, height=4, dpi=100)) #self.mw.connect(self.ui.pushButton, QtCore.SIGNAL("clicked()"), self.test) #print self.mw.connect(self.ui.tableView.horizontalHeader(), QtCore.SIGNAL("sortIndicatorChanged(int,Qt.SortOrder)"), self.headerSort) self.db = QtSql.QSqlDatabase.addDatabase("QMYSQL") self.db.setDatabaseName("moodle1") self.db.setHostName("ssproot") self.db.setUserName("root") self.db.setPassword("f,f,fufkfvfuf") if not self.db.open(): raise Exception("БД не відкрилася") self.log_dict=dict() self.assignment_list() self.log_unmarcked_assignment() self.log_print() #raise ExceptionType("message") self.mw.showMaximized() sys.exit(self.app.exec_())
def __init__(self, parent=None): QWidget.__init__(self, parent) self.ui = uic.loadUiType('main.ui')[0]() self.ui.setupUi(self) self.localize() self.ui.config.setup(self.ui.terminals, self.ui.payments) self.tabs = [self.ui.terminals, self.ui.payments, self.ui.config] self.ui.terminals.ready.connect(self.ui.config.terminals_ready) self.left_terminals = [] self.right_terminals = [] self.ui.leftUp.clicked.connect(self.left_up) self.ui.leftDown.clicked.connect(self.left_down) self.ui.rightUp.clicked.connect(self.right_up) self.ui.rightDown.clicked.connect(self.right_down) self.end_session() self.notifier = QSystemTrayIcon(QIcon('arrow-up-icon.png'), self) self.notifier.show() self.session = None self.executor = self.setup_executor() self.executor.start()
def loadUiType(uiFile, imagePath): '''Convert the image paths in the given .ui file to search paths using a resource prefix This is because it's a pain to setup relative resource paths in designer. Return a new class to inherit from''' def correctImagePaths(text, prefix): newText = text if text.lower().rsplit('.')[-1] in ['png', 'bmp', 'jpg', 'gif', 'tga']: newText = prefix+':'+os.path.basename(text) return newText ui = xml.parse(uiFile) #Iterate over the xml file, and replace paths that have image extensions at the end for item in ui.getiterator(): if item.text: item.text = correctImagePaths(item.text, 'images') if item.tail: item.tail = correctImagePaths(item.tail, 'images') if item.tag: item.tag = correctImagePaths(item.tag, 'images') #Set the search paths prefix QtCore.QDir.setSearchPaths('images', [imagePath]) #Create a temporary file-like string buffer, and pass that to loadUiType f = StringIO(xml.tostring(ui.getroot())) form_class, base_class = uic.loadUiType(f) class windowClass(form_class, base_class): '''Simple class wrapper for a ui file object''' def __init__(self, parent=None): super(base_class, self).__init__(parent) self.setupUi(self) return windowClass
def __init__(self): QtGui.QDialog.__init__(self) uifile = 'settings.ui' uipath = os.path.join(uidir, uifile) SClass, _ = uic.loadUiType(uipath) self.ui = SClass() self.ui.setupUi(self) self.load_current()
def __init__(self, parent): self.parent = parent QtGui.QDialog.__init__(self) uipath = os.path.join(UI_FILES_PATH, 'settings.ui') SClass, _ = uic.loadUiType(uipath) self.ui = SClass() self.ui.setupUi(self) self.setcurrent()
from PyQt4 import QtGui, QtCore, uic import dropbox from dropbox.files import FileMetadata, FolderMetadata from dropbox import DropboxOAuth2FlowNoRedirect import datetime import os import time from PyQt4.QtCore import * from PyQt4.QtGui import * from classes import * import pickle #Varios contenidos son extraidos del ejemplo de la API de Dropbox #Estos son modificados con el fin de ajustarlos al enunciado formulario = uic.loadUiType("error.ui") class ErrorWidget(formulario[0], formulario[1]): def __init__(self): super().__init__() self.setupUi(self) self.okButton.clicked.connect(self.ok) def ok(self, button): self.hide() def Show(self, m): self.label.setText(m) self.show()
/*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ """ import os from PyQt4 import QtGui, uic, QtCore FORM_CLASS, _ = uic.loadUiType(os.path.join( os.path.dirname(__file__), 'LQF_dialog_base.ui')) class LQFDialog(QtGui.QDialog, FORM_CLASS): def __init__(self, parent=None): """Constructor.""" super(LQFDialog, self).__init__(parent) # Set up the user interface from Designer. # After setupUI you can access any designer object by doing # self.<objectname>, and you can use autoconnect slots - see # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html # #widgets-and-dialogs-with-auto-connect self.setupUi(self) # print self.dlg
***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ """ import os from PyQt4 import QtGui, uic FORM_CLASS, _ = uic.loadUiType( os.path.join(os.path.dirname(__file__), 'prof_tab.ui')) class ProfTab(QtGui.QWidget, FORM_CLASS): def __init__(self, parent=None): """Constructor.""" super(ProfTab, self).__init__(parent) # Set up the user interface from Designer. # After setupUI you can access any designer object by doing # self.<objectname>, and you can use autoconnect slots - see # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html # #widgets-and-dialogs-with-auto-connect self.setupUi(self)
__author__ = 'Robel' import os from qgis.core import * from PyQt4 import QtGui, uic from qgis.utils import * from PyQt4.QtGui import QMessageBox from Connection import ConnectionHandler from task_manager_dialog import TaskManagerDialog from ShowTaskArea import showTaskArea FORM_CLASS, _ = uic.loadUiType(os.path.join( os.path.dirname(__file__), 'UI/feature_property_dialog.ui')) class featureProperty(QtGui.QDialog, FORM_CLASS): def __init__(self, parent=None): """Constructor.""" super(featureProperty, self).__init__(parent) # Set up the user interface from Designer. # After setupUI you can access any designer object by doing # self.<objectname>, and you can use autoconnect slots - see # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html # #widgets-and-dialogs-with-auto-connect self.setupUi(self) self.okButton.clicked.connect(self.update) self.cancelButton.clicked.connect(self.cancelClicked) def populate(self): taskMgrDlg=TaskManagerDialog() OID=taskMgrDlg.oid_value() print OID con=ConnectionHandler()
from threading import Thread, Lock, Timer from Queue import Queue from datetime import datetime from sets import Set import numpy as np from threadhandler import ThreadHandler from arduinohandler import * import math import serial.tools.list_ports as serial_tools from datetime import datetime from mingus.midi import fluidsynth from mingus.containers import Note from mingus.containers import MidiInstrument #------------------------------------------------------------------------------ Ui_MainWindow, QMainWindow = loadUiType('mainwindow.ui') #------------------------------------------------------------------------------ class Main(QMainWindow, Ui_MainWindow): def __init__(self): super(Main, self).__init__() self.setupUi(self) self.avr = None self.threshold1 = 1.0 self.threshold2 = 2.0 self.threshold3 = 3.0 self.threshold1reached = False self.threshold2reached = False
__revision__ = '$Format:%H$' import os from PyQt4 import uic from PyQt4.QtCore import Qt, QEvent, QPyNullVariant from PyQt4.QtGui import (QFileDialog, QDialog, QIcon, QStyle, QStandardItemModel, QStandardItem, QMessageBox, QStyledItemDelegate, QLineEdit, QSpinBox, QDoubleSpinBox, QWidget, QToolButton, QHBoxLayout) from processing.core.ProcessingConfig import ProcessingConfig, Setting from processing.core.Processing import Processing pluginPath = os.path.split(os.path.dirname(__file__))[0] WIDGET, BASE = uic.loadUiType(os.path.join(pluginPath, 'ui', 'DlgConfig.ui')) class ConfigDialog(BASE, WIDGET): def __init__(self, toolbox): super(ConfigDialog, self).__init__(None) self.setupUi(self) self.toolbox = toolbox self.groupIcon = QIcon() self.groupIcon.addPixmap( self.style().standardPixmap(QStyle.SP_DirClosedIcon), QIcon.Normal, QIcon.Off) self.groupIcon.addPixmap( self.style().standardPixmap(QStyle.SP_DirOpenIcon), QIcon.Normal, QIcon.On)
***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ """ import os from PyQt4 import QtGui, uic mainFormClass, notImportant = uic.loadUiType( os.path.join(os.path.dirname(__file__), 'main.ui')) step1FormClass, notImportant = uic.loadUiType( os.path.join(os.path.dirname(__file__), 'step1.ui')) step2FormClass, notImportant = uic.loadUiType( os.path.join(os.path.dirname(__file__), 'step2.ui')) step3FormClass, notImportant = uic.loadUiType( os.path.join(os.path.dirname(__file__), 'step3.ui')) class mainDialog(QtGui.QDialog, mainFormClass): def __init__(self): QtGui.QDialog.__init__(self) self.setupUi(self) class step1Dialog(QtGui.QDialog, step1FormClass):
import sys, gc from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.uic import loadUiType import numpy as np from matplotlib.figure import Figure from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar from lib.classLib import scanData, analysisDatas from lib.funLib import DraggableVLine, DraggableHLine, RectangleSelector Ui_MainWindow, QMainWindow = loadUiType('gui_layout/lh_gui.ui') # Creation of classes for analysis class Main(QMainWindow, Ui_MainWindow): ########################### Initlization part ########################### def __init__(self, foldername=None): ''' Initialization of main window ''' if foldername == None: #Initiate main window super(Main, self).__init__() self.setupUi(self)
''' return str(output if pyQtVersion == "PyQt4" else output[0]) #import python libs import os import sys import unittest import subprocess from matplotlib import animation import matplotlib.pyplot as plt # import UI created in designer sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) ui_folder = os.path.dirname(__file__)+"/" #ui_folder = 'mpl_animationmanager/' Ui_QDialogAnimManager, QDilaog = loadUiType(ui_folder+'QDialogAnimManager.ui') # classes definition class QDialogAnimManager(QDilaog, Ui_QDialogAnimManager): ''' PyQt dialog for creation, setting up and exporting matplotlib animations. Atimation frames change according to fAnim(i, ax, fargs) funcition. Widget can deal with both 2D and 3D axes. For 3D axes manager can add additional rotation of the view point resulting in both object modification and rotation animation. If fAnim(i, ax, fargs) is not provided 3D object anyway can be animated with the rotation animation. ''' closed = pyqtSignal(object) # used for interaction with parent
Connection dialogue that will list available Crazyflies and the user can choose which to connect to. """ __author__ = 'Bitcraze AB' __all__ = ['ConnectionDialogue'] import sys from PyQt4 import Qt, QtCore, QtGui, uic from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.Qt import * import cflib.crtp connect_widget_class, connect_widget_base_class = uic.loadUiType(sys.path[0] + '/cfclient/ui/dialogs/connectiondialogue.ui') class ConnectDialogue(QtGui.QWidget, connect_widget_class): # Outgoing signal for connecting a Crazyflie requestConnectionSignal = pyqtSignal(str) def __init__(self, *args): super(ConnectDialogue, self).__init__(*args) self.setupUi(self) self.scanner = ScannerThread() self.scanner.start() # Connect signals to slots self.connectButton.clicked.connect(self.openConnection)
copyright : (C) 2018 by BernardoSargento&NelsonMileu email : a ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ """ import os from PyQt4 import QtGui, uic FORM_CLASS, _ = uic.loadUiType(os.path.join( os.path.dirname(__file__), 'Perigosidade_PMDFCI_dialog_base.ui')) class Perigosidade_PMDFCIDialog(QtGui.QDialog, FORM_CLASS): def __init__(self, parent=None): """Constructor.""" super(Perigosidade_PMDFCIDialog, self).__init__(parent) # Set up the user interface from Designer. # After setupUI you can access any designer object by doing # self.<objectname>, and you can use autoconnect slots - see # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html # #widgets-and-dialogs-with-auto-connect self.setupUi(self)
import os from PyQt4 import uic from PyQt4.QtGui import QMenu, QAction, QCursor, QInputDialog from qgis.core import QgsRasterLayer, QgsVectorLayer from qgis.utils import iface from processing.gui.RectangleMapTool import RectangleMapTool from processing.core.parameters import ParameterRaster from processing.core.parameters import ParameterVector from processing.core.parameters import ParameterMultipleInput from processing.tools import dataobjects pluginPath = os.path.split(os.path.dirname(__file__))[0] WIDGET, BASE = uic.loadUiType( os.path.join(pluginPath, 'ui', 'widgetBaseSelector.ui')) class ExtentSelectionPanel(BASE, WIDGET): def __init__(self, dialog, alg, default): super(ExtentSelectionPanel, self).__init__(None) self.setupUi(self) self.dialog = dialog self.params = alg.parameters if self.canUseAutoExtent(): if hasattr(self.leText, 'setPlaceholderText'): self.leText.setPlaceholderText( self.tr('[Leave blank to use min covering extent]')) self.btnSelect.clicked.connect(self.selectExtent)
* it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ """ #pyrcc4 -o C:\Users\localadmin\.qgis2\python\plugins\presentatie\resources.py C:\Users\localadmin\.qgis2\python\plugins\presentatie\resources.qrc import os from PyQt4 import QtGui, uic from PyQt4.QtCore import pyqtSignal from qgis.core import * from qgis.gui import * from qgis.utils import iface FORM_CLASS, _ = uic.loadUiType(os.path.join( os.path.dirname(__file__), 'presentatie_dockwidget_base.ui')) class presentatieDockWidget(QtGui.QDockWidget, FORM_CLASS): closingPlugin = pyqtSignal() count = 0 layerlist = [] mapCanvas = None legend = None def __init__(self, parent=None): super(presentatieDockWidget, self).__init__(parent) self.setupUi(self) self.iface = iface self.pushButton.clicked.connect(self.volgende)
from PyQt4.QtSql import QSqlDatabase from PyQt4 import QtGui, uic #, QtXml from PyQt4.QtCore import pyqtSignal, pyqtSlot, QSettings, Qt from PyQt4.QtGui import QApplication from qgis.gui import QgsMessageBar, QgsMapTool from qgis.utils import iface from qgis.core import QgsCoordinateReferenceSystem, QgsCoordinateTransform, QgsGeometry, QgsMapLayer from mapTools import AddPointTool, CaptureTool from canvas_items import CanvasItems from impact_analysis2_tr import tr from impact_analysis_results_dialog import ImpactAnalysisResultsDialog import resources FORM_CLASS, _ = uic.loadUiType(os.path.join( os.path.dirname(__file__), 'impact_analysis2_dockwidget_base.ui')) class ImpactAnalysis2DockWidget(QtGui.QDockWidget, FORM_CLASS): closingPlugin = pyqtSignal() def __init__(self, parent=None, iface=None): """Constructor.""" super(ImpactAnalysis2DockWidget, self).__init__(parent) # Local references to QGIS iface and parent self.iface = iface # Create (empty) references for search geometry and for "old" search geometry self.searchobj = None
@author: User """ import logging import ctypes from PyQt4 import QtCore, QtGui, uic import app.view.rest_izbornik as rest_izbornik import app.view.grafovi_panel as grafovi_panel import app.general.app_dto as app_dto import app.control.kontroler as kontroler import app.view.auth_login as auth_login import app.view.glavni_dijalog as glavni_dijalog from app.view.pregled_komentara import PregledKomentara base, form = uic.loadUiType('./app/view/ui_files/display.ui') class GlavniProzor(base, form): """ Glavni prozor aplikacije """ def __init__(self, cfg=None, parent=None): logging.debug('inicijalizacija GlavniProzor, start.') super(base, self).__init__(parent) self.setupUi(self) self.config = cfg #set up inicijalizaciju self.setup_main_window() logging.debug('inicijalizacija GlavniProzor, kraj.') def setup_main_window(self): """
# -*- coding: utf-8 -*- """ Created on Sat Dec 2 21:57:02 2017 @author: Alexis """ from PyQt4 import QtCore, QtGui, uic from PyQt4.QtGui import QTableWidgetItem, QHeaderView, QColor from tpentrerios import grafo from archivoG import abrir,cerrar from cargarViajes import CargarViaje menu = uic.loadUiType("interfaz/admin.ui")[0] fileVertices = abrir("vertices") fileAristas = abrir("aristas") #cerrar(fileVertices) class Administracion(QtGui.QDialog, menu): def __init__(self, parent=None): QtGui.QDialog.__init__(self, parent) self.setupUi(self) self.setWindowTitle("Administración") self.setWindowIcon(QtGui.QIcon('admin_user_man_22187.ico')) self.grafo = grafo() self.grafo.iniVertices(fileVertices)
from PyQt4 import QtGui, uic import os from qgis.core import * FORM_CLASS, _ = uic.loadUiType(os.path.join( os.path.dirname(__file__), 'QRealTime_dialog_import.ui')) class importData(QtGui.QDialog, FORM_CLASS): def __init__(self,parent=None): super(importData,self).__init__(parent) self.setupUi(self)
def get_ui_class(ui_file): """return class object of a uifile""" ui_file_full = '%s%sui%s%s' % (os.path.dirname( os.path.abspath(__file__)), os.sep, os.sep, ui_file) return loadUiType(ui_file_full)[0]
***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ """ import os from PyQt4 import QtGui, uic FORM_CLASS, _ = uic.loadUiType( os.path.join(os.path.dirname(__file__), 'montante_jusante_dialog_base.ui')) class MontanteJusanteDialog(QtGui.QDialog, FORM_CLASS): def __init__(self, parent=None): """Constructor.""" super(MontanteJusanteDialog, self).__init__(parent) # Set up the user interface from Designer. # After setupUI you can access any designer object by doing # self.<objectname>, and you can use autoconnect slots - see # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html # #widgets-and-dialogs-with-auto-connect self.setupUi(self)
***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ """ import os from PyQt4 import QtGui, uic FORM_CLASS, _ = uic.loadUiType(os.path.join( os.path.dirname(__file__), 'Raster_Data02_dialog_base.ui')) class RasterData02Dialog(QtGui.QDialog, FORM_CLASS): def __init__(self, parent=None): """Constructor.""" super(RasterData02Dialog, self).__init__(parent) # Set up the user interface from Designer. # After setupUI you can access any designer object by doing # self.<objectname>, and you can use autoconnect slots - see # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html # #widgets-and-dialogs-with-auto-connect self.setupUi(self)
from PyQt4 import QtGui, QtCore, uic import os basepath = os.path.dirname(__file__) path = os.path.join(basepath,"selection.ui") base, form = uic.loadUiType(path) class LineSelectionEditor(base, form): def __init__(self, parent=None): super(base, self).__init__(parent) self.parent = parent self.setupUi(self) lines = ['S+1/2D+3/2', 'S-1/2D+1/2', 'carrier -1/2-5/2', 'carrier -1/2-1/2', 'S+1/2D-1/2', 'OP', 'S+1/2D+5/2', 'Right OP', 'S-1/2D-3/2', 'S+1/2D+1/2' ] selections = '\n'.join(lines) self.uiInput.setText(selections) self.uiInput.setReadOnly(True) def guess(self): ''' Nothing to guess '''
# -*- coding: utf-8 -*- """ Created on Sun Jul 1 18:25:42 2018 @author: Alexis """ import sys, time from PyQt4 import QtGui, uic, QtCore from PyQt4.QtGui import QPixmap from ayuda import Ayuda menu = uic.loadUiType("interfaz/main2.ui")[0] class Ventana(QtGui.QMainWindow, menu): def __init__(self): QtGui.QMainWindow.__init__(self) self.setupUi(self) self.setWindowTitle("AFD mínimo") self.setWindowIcon(QtGui.QIcon(QPixmap("logoapp.png"))) self.setFixedSize(self.size()) self.imagen.setPixmap(QPixmap("AFD minimo.png")) self.play.setIcon(QtGui.QIcon(QPixmap('play.png'))) self.stop.setIcon(QtGui.QIcon('Stop1NormalBlue_26947.ico')) self.validar.setIcon(QtGui.QIcon('check_ok_accept_apply_1582.ico'))
from PyQt4 import QtGui, uic from PyQt4.QtGui import QListWidgetItem from PyQt4.QtCore import QSettings, QTranslator, qVersion, QCoreApplication from PyQt4.QtGui import QAction, QIcon, QMessageBox, QFileDialog import os FORM_CLASS, _ = uic.loadUiType( os.path.join(os.path.dirname(__file__), 'time_displayer.ui')) from qgis.core import QgsMessageLog, QgsMapLayerRegistry, QgsVectorLayer, QgsMapRenderer, QgsRectangle from PythonQF2.DataManagement.spatialHelpers import populateShapefileFromTemplate, colourRanges, openShapeFileInMemory, duplicateVectorLayer try: import pandas as pd import numpy as np from matplotlib.patches import Rectangle from matplotlib import pyplot except: pass from datetime import datetime as dt from PyQt4.QtGui import QImage, QColor, QPainter from PyQt4.QtCore import QSize def makeRect(color): return Rectangle((0, 0), 1, 1, fc=color) # Creates a dialog box that allow different model output time slices to be visualised in QGIS def intOrString(x): # Return integer representation if possible, or string if not try: return int(x)
from controller.raspberryPi_commands import * from helper.utils import shortenPath, serialNumberCheck from helper.agilent_34461 import A34461 from helper.gpio_no_sudo import * from multiprocessing import Array, Process from multiprocessing.queues import SimpleQueue import os import time import re import subprocess import sys from PyQt4 import QtCore, QtGui, uic log_queue = SimpleQueue() form_class = uic.loadUiType( "/home/pi/misfit/Production/src/view/mainwindow.ui")[0] class MainWindowClass(QtGui.QMainWindow, form_class): def __init__(self, parent=None): QtGui.QMainWindow.__init__(self, parent) self.setupUi(self) self.startButton.clicked.connect(self.start) self.resetPushButton.clicked.connect(self.clickedResetPushButton) self.startButton.setStyleSheet("background-color: green;") self.totalTestsRunCount = 0 self.totalTestsPassedCount = 0 self.totalTestsFailedCount = 0 if MANUFACTURER_NAME != "GT":
***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ """ import os from PyQt4 import QtGui, uic FORM_CLASS, _ = uic.loadUiType( os.path.join(os.path.dirname(__file__), 'plugin_test_1_dialog_base.ui')) class PluginTest1Dialog(QtGui.QDialog, FORM_CLASS): def __init__(self, parent=None): """Constructor.""" super(PluginTest1Dialog, self).__init__(parent) # Set up the user interface from Designer. # After setupUI you can access any designer object by doing # self.<objectname>, and you can use autoconnect slots - see # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html # #widgets-and-dialogs-with-auto-connect self.setupUi(self)
from PyQt4.QtCore import * from PyQt4 import uic from Mondrian_L_Diversity import anonymizer from Mondrian_L_Diversity.models import gentree from help import HelpWindow from level import LevelWizard from table import display_data_set_on_table, load_csv_as_data_set, save_data_set_as_csv from input_file import InputFileWizard from processing import ProcessingDialog from deidentification_methods import mask from risk import risk reload(sys) sys.setdefaultencoding('utf8') form_class = uic.loadUiType(os.path.join(os.path.dirname(__file__), u'ui', u'main.ui'))[0] class MainWindow(QMainWindow, form_class): """ 메인 윈도우 """ def __init__(self): super(MainWindow, self).__init__() # 멤버 self.processing_dialog = None self.data_process_thread = None self.input_file_name = None self.input_attributes = None
def __init__(self): addr = 'logs/{}{}'.format( dt.datetime.now().strftime('%Y-%m-%d-%H-%M-%S'), '.log') logging.basicConfig(filename=addr, level=logging.DEBUG) logging.debug('Run MainWindow.__init__();') QtGui.QMainWindow.__init__(self) global lang if lang == 'En_en': path = 'res/ui/Main/en_main.ui' elif lang == 'Ru_ru': path = 'res/ui/Main/ru_main.ui' uicl, qtbaseclass = uic.loadUiType(path) del qtbaseclass self.ui = uicl() logging.debug('Setup UI;') self.ui.setupUi(self) # create items self.tableWidgets = [] self.gr_widgets = [ QtGui.QTreeWidgetItem(self.ui.GroupView) for x in range(2) ] self.gr_widgets[0].setText(0, 'Internet') self.gr_widgets[1].setText(0, 'Email') self.ingr_widgets = {'Internet': {}, 'Email': {}} # run some functions center(self) self.toolBarInst() # create some variables self.base_addr = None self.sql = SqlWorker() self.chifrator = Chifrator() self.base_chifrator = CryptBase() global count self.count = count self.t_itm = QtGui.QTreeWidgetItem self.base_pwd = None self.file_dlg = QtGui.QFileDialog self.clipboard = QtGui.QApplication.clipboard() self.groupData = None # self.actionAdd_data = QtGui.QAction('Add data', self) self.actionAdd_data.setVisible(True) self.actionEdit_gr = QtGui.QAction('Edit data', self) self.actionCopyPwd_gr = QtGui.QAction('Copy password to clipboard', self) self.actionCopyLogin_gr = QtGui.QAction('Copy login to clipboard', self) self.actionAddNewGroup_gr = QtGui.QAction('Add new group', self) self.actionDuplicate_gr = QtGui.QAction('Duplicate this data', self) self.actionDelete_gr = QtGui.QAction('Delete this data', self) self.actionDelete_group = QtGui.QAction('Delete this group', self) self.installContextMenuToGroups() # self.actionAdd_data_data = QtGui.QAction('Add data', self) self.actionEdit_data = QtGui.QAction('Edit data', self) self.actionCopyPwd_data = QtGui.QAction('Copy password to clipboard', self) self.actionCopyLogin_data = QtGui.QAction('Copy login to clipboard', self) self.actionDuplicate_data = QtGui.QAction('Duplicate this data', self) self.actionDelete_data = QtGui.QAction('Delete this data', self) self.installContextMenuToData() self.iconInstaller() # self.ui.actionBlock_this_window.setEnabled(False) self.ui.actionChange_master_pwd.setEnabled(False) # create connections self.ui.actionCreate_database.triggered.connect(self.CreateBase) self.ui.actionOpen_database.triggered.connect(self.OpenBase) self.ui.actionClose_database.triggered.connect(self.closeBase) self.ui.actionSave_database_as.triggered.connect(self.saveBaseAs) self.ui.actionAdd_data_to_base.triggered.connect(self.addDataToBase) self.ui.actionView_Edit_data_on_base.triggered.connect( self.editData_Group) self.ui.actionDelete_data.triggered.connect(self.delData_gr) self.ui.GroupView.itemClicked.connect(self.TableView) self.ui.GroupView.itemDoubleClicked.connect(self.TableView) self.ui.GroupView.itemEntered.connect(self.TableView) self.ui.GroupView.itemPressed.connect(self.TableView) self.ui.GroupView.itemSelectionChanged.connect(self.TableView) self.ui.actionExit.triggered.connect(self.close) self.actionAddNewGroup_gr.triggered.connect(self.addGroup_gr) self.actionAdd_data.triggered.connect(self.addDataToBase) self.actionEdit_gr.triggered.connect(self.editData_Group) self.actionDelete_gr.triggered.connect(self.delData_gr) self.actionDelete_group.triggered.connect(self.delGroup) self.actionCopyLogin_gr.triggered.connect(self.copyLogin_Group) self.actionCopyPwd_gr.triggered.connect(self.copyPassword_Group) self.ui.actionCopy_login_to_clipboard.triggered.connect( self.copyLogin_Group) self.ui.actionCopy_password_to_clipboard.triggered.connect( self.copyPassword_Group) self.actionEdit_gr.triggered.connect(self.editData_Group) self.actionAdd_data_data.triggered.connect(self.addDataToBase) self.actionEdit_data.triggered.connect(self.editData_Data) self.actionDuplicate_data.triggered.connect(self.duplicate_data_Data) self.actionDelete_data.triggered.connect(self.del_data_data) self.actionCopyLogin_data.triggered.connect(self.copyLogin_Data) self.actionCopyPwd_data.triggered.connect(self.copyPassword_Data) self.actionDuplicate_gr.triggered.connect(self.duplicate_gr) self.ui.actionPassword_genrator.triggered.connect(self.runPwdGenerator) self.ui.actionSearch_in_database.triggered.connect(self.runFindInBase) self.ui.actionSave_database.triggered.connect(self.saveDatabse) self.ui.actionBlock_this_window.triggered.connect(self.blockWindow) self.ui.actionAbout.triggered.connect(self.about) self.ui.actionSettings.triggered.connect(self.runSettings)
import sys reload(sys) sys.setdefaultencoding('utf8') import sys import traceback from collections import OrderedDict from PyQt4 import QtCore, QtGui, uic import category_v3 as cat import re # qtCreatorFile = "D:\python\myfiles\\continental\\continental_v2.ui" # Enter file here. qtCreatorFile = "continental_v3.ui" # Enter file here. Ui_MainWindow, QtBaseClass = uic.loadUiType(qtCreatorFile) class MyApp(QtGui.QMainWindow, Ui_MainWindow): def __init__(self): QtGui.QMainWindow.__init__(self) Ui_MainWindow.__init__(self) self.setupUi(self) self.abstract_but.clicked.connect(self.abstract_flight_info) self.run_but.clicked.connect(self.run_continent) def abstract_flight_info(self): #读入航班信息: f = open('flight_information.txt', 'r') flight_info = {}
# Listing_20-1.py # Copyright Warren & Csrter Sande, 2013 # Released under MIT license http://www.opensource.org/licenses/mit-license.php # Version $version ---------------------------- # Najbardziej podstawowy kod PyQt import sys from PyQt4 import QtCore, QtGui, uic # Importujemy wymagane biblioteki PyQt klasa_formularza = uic.loadUiType("MojPierwszyGui.ui")[ 0] # £adujemy UI utworzone wczeœniej w Qt Designerze class KlasaMojeOkno(QtGui.QMainWindow, klasa_formularza): def __init__(self, parent=None): QtGui.QMainWindow.__init__(self, parent) self.setupUi(self) app = QtGui.QApplication(sys.argv) # Program PtQt, który wyœwietla okno mojeOkno = KlasaMojeOkno() # Tworzymy instancjê klasy okna mojeOkno.show() # Uruchamiamy program app.exec_() # i wyœwietlamy GUI
import sys from PyQt4 import QtGui, QtCore, uic from twisted.internet.defer import inlineCallbacks, Deferred path = sys.path[0] + r"\Module Template" ScanControlWindowUI, QtBaseClass = uic.loadUiType(path + r"\Template.ui") Ui_ServerList, QtBaseClass = uic.loadUiType(path + r"\requiredServers.ui") #Not required, but strongly recommended functions used to format numbers in a particular way. sys.path.append(sys.path[0]+'\Resources') from nSOTScannerFormat import readNum, formatNum class Window(QtGui.QMainWindow, ScanControlWindowUI): def __init__(self, reactor, parent=None): super(Window, self).__init__(parent) self.reactor = reactor self.setupUi(self) self.setupAdditionalUi() self.moveDefault() #Connect show servers list pop up self.push_Servers.clicked.connect(self.showServersList) #Initialize all the labrad connections as none self.cxn = None self.dv = None self.lockInterface()