def __init__(self, parent, lumencorInstance): super(LumencorManipDialog, self).__init__(parent) self.lumencorInstance = lumencorInstance # Note that uic.loadUiType(..) returns a tuple containing two class types (the form class and the Qt base # class). The line below instantiates the form class. It is assumed that the .ui file resides in the same # directory as this .py file. self.ui = uic.loadUiType(os.path.join(os.path.dirname(__file__), 'direct_manip.ui'))[0]() self.ui.setupUi(self) evalstr = 'self.ColorControlSet(self.ui.{0}Toggle, self.ui.{0}Slider, self.ui.{0}SpinBox, ' evalstr += 'Lumencor.__dict__["{0}Enabled"].__set__, Lumencor.__dict__["{0}Power"].__set__)' self.colorControlSets = {color : eval(evalstr.format(color), {'self':self, 'Lumencor':Lumencor}) for color in Lumencor._lampNames} # Update interface to reflect current state of Lumencor box (which may be something other than default if this dialog was # attached to an existing Lumencor instance that has previously been manipulated) self.deviceLampStatesChangedSlot({ln : {'enabled' : ls.enabled, 'power' : ls.power} for ln, ls in self.lumencorInstance.lampStates.items()}) for c, ccs in self.colorControlSets.items(): # Handle toggle by color name so color enable/disable command can be sent to lumencor driver ccs.toggle.toggled.connect(lambda on, colorControlSet=ccs: self.colorEnabledWidgetToggledSlot(colorControlSet, on)) # Send slider changes to lumencor driver ccs.slider.sliderMoved.connect(lambda intensity, colorControlSet=ccs: self.colorIntensityWidgetChangedSlot(colorControlSet, intensity)) # Send spinbox changes to lumencor driver ccs.spinBox.valueChanged.connect(lambda intensity, colorControlSet=ccs: self.colorIntensityWidgetChangedSlot(colorControlSet, intensity)) self.lumencorInstance.lampStatesChanged.connect(self.deviceLampStatesChangedSlot) self.tempUpdateTimer = QtCore.QTimer(self) self.tempUpdateTimer.timeout.connect(self.tempUpdateTimerFiredSlot) self.tempUpdateConsecutiveFailures = 0 self.tempUpdateTimer.start(2000)
def __init__(self, parent=None): QWidget.__init__(self, parent) Form, Base = uic.loadUiType('calc.ui') self.form = Form() self.form.setupUi(self) self.number_one = 0 self.number_two = 0 self.operation = '' self.text_number_one = '' self.text_number_two = '' self.form.pushButton.clicked.connect(self.handler) self.form.pushButton_2.clicked.connect(self.handler) self.form.pushButton_3.clicked.connect(self.handler) self.form.pushButton_4.clicked.connect(self.handler) self.form.pushButton_5.clicked.connect(self.handler) self.form.pushButton_6.clicked.connect(self.handler) self.form.pushButton_7.clicked.connect(self.handler) self.form.pushButton_8.clicked.connect(self.handler) self.form.pushButton_9.clicked.connect(self.handler) self.form.pushButton_10.clicked.connect(self.handler) self.form.pushButton_11.clicked.connect(self.handler) self.form.pushButton_12.clicked.connect(self.handler) self.form.pushButton_13.clicked.connect(self.handler) self.form.pushButton_14.clicked.connect(self.handler) self.form.pushButton_15.clicked.connect(self.handler) self.form.pushButton_16.clicked.connect(self.handler) self.form.pushButton_17.clicked.connect(self.handler) self.form.pushButton_18.clicked.connect(self.handler) self.form.lcdNumber.setNumDigits(10)
def __init__( self, dimensions, feature_table, req_features=None, selected_features=None, title=None, parent=None, initial_settings=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._setup_settings(initial_settings or {}) self.ui.featureView.setHeaderLabels(("Select Features",)) self.ui.featureView.expandAll() self.ui.exportPath.dropEvent = self._drop_event # self.ui.forceUniqueIds.setEnabled(dimensions[0] > 1) self.ui.compressFrame.setVisible(False)
def __init__(self, parent=None): QWidget.__init__(self, parent) Form, Base = uic.loadUiType('calc.ui') self.form = Form() self.form.setupUi(self) self.form.b1.clicked.connect(self.handler) self.form.b2.clicked.connect(self.handler) self.form.b3.clicked.connect(self.handler) self.form.b4.clicked.connect(self.handler) self.form.b5.clicked.connect(self.handler) self.form.b6.clicked.connect(self.handler) self.form.b7.clicked.connect(self.handler) self.form.b8.clicked.connect(self.handler) self.form.b9.clicked.connect(self.handler) self.form.b0.clicked.connect(self.handler) self.form.b_dot.clicked.connect(self.handler) self.form.b_div.clicked.connect(self.handler) self.form.b_minus.clicked.connect(self.handler) self.form.b_mult.clicked.connect(self.handler) self.form.b_plus.clicked.connect(self.handler) self.form.b_eq.clicked.connect(self.handler) self.form.b_clear.clicked.connect(self.handler) self.form.lcdNumber.setNumDigits(10) self.number_one = None self.number_two = None self.operation = None
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 __init__(self, risWidget, dict_, parent): super().__init__(parent) self._rw = risWidget self._db = dict_ self._ui = uic.loadUiType(os.path.join(os.path.dirname(__file__), 'manually_score_images.ui'))[0]() self._ui.setupUi(self) self._scoreRadioGroup = Qt.QButtonGroup(self) self._scoreRadioGroup.addButton(self._ui.radioNone, self._ScoreRadioId.ClearScore) self._scoreRadioGroup.addButton(self._ui.radio0, self._ScoreRadioId.SetScore0) self._scoreRadioGroup.addButton(self._ui.radio1, self._ScoreRadioId.SetScore1) self._scoreRadioGroup.addButton(self._ui.radio2, self._ScoreRadioId.SetScore2) self._ui.actionUp.triggered.connect(self._ui.prevGroupButton.animateClick) self._ui.actionDown.triggered.connect(self._ui.nextGroupButton.animateClick) self._ui.actionLeft.triggered.connect(self._ui.prevButton.animateClick) self._ui.actionRight.triggered.connect(self._ui.nextButton.animateClick) self._ui.actionBackspace.triggered.connect(self._ui.radioNone.animateClick) self._ui.action0.triggered.connect(self._ui.radio0.animateClick) self._ui.action1.triggered.connect(self._ui.radio1.animateClick) self._ui.action2.triggered.connect(self._ui.radio2.animateClick) self.addActions([self._ui.actionUp, self._ui.actionDown, self._ui.actionLeft, self._ui.actionRight, self._ui.actionBackspace, self._ui.action0, self._ui.action1, self._ui.action2])
def __init__(self, parent=None): QWidget.__init__(self, parent) Form, Base = uic.loadUiType("MyCalcForm.ui") # Form - класс окошка в дизайнере self.form = Form() self.form.setupUi(self) # связываем объект Form(окошко) с виджетами # QPush_Buttons with button func self.form.Exit.clicked.connect(Qt.qApp.quit) # Button "Exit" self.form.one_num.clicked.connect(self.one_num_button) self.form.two_num.clicked.connect(self.two_num_button) self.form.three_num.clicked.connect(self.three_num_button) self.form.four_num.clicked.connect(self.four_num_button) self.form.five_num.clicked.connect(self.five_num_button) self.form.six_num.clicked.connect(self.six_num_button) self.form.seven_num.clicked.connect(self.seven_num_button) self.form.eight_num.clicked.connect(self.eight_num_button) self.form.nine_num.clicked.connect(self.nine_num_button) self.form.zero_num.clicked.connect(self.zero_num_button) # QPush_Buttons with operation func self.form.plus.clicked.connect(self.plus_button) self.form.minus.clicked.connect(self.minus_button) self.form.multiply.clicked.connect(self.multiply_button) self.form.divide.clicked.connect(self.divide_button) self.form.equally.clicked.connect(self.equally_button) self.form.delete_all.clicked.connect(self.delete_all_button) #self.form.delete_2.clicked.connect(self.delete_2_button) #self.form.koma.clicked.connect(self.koma_button) self.form.sqrt.clicked.connect(self.sqrt_button) self.input_list_1 = 0 self.input_list_2 = 0 self.symbol_list = "" self.output_list = 0
def __init__(self, uiFile): print(uiFile) super(FCPidWidget, self).__init__() # 读取/设置ui文件 UIClass = loadUiType(uiFile) self.mUi = UIClass[0]() self.mUi.setupUi(self) # 加入波形控件 self.mWaveWidget = FCWaveWidget() self.mWaveGroupBox = self.mUi.waveGroupBox vbox = QVBoxLayout() vbox.addWidget(self.mWaveWidget) self.mWaveGroupBox.setLayout(vbox) # 基本配置 self.mIpLabel = self.mUi.ipLabel self.mPortLabel = self.mUi.portLabel self.mDataPathLabel = self.mUi.dataPathLabel self.mIpLabel.setText("IP:" + str(gLocalIP)) self.mPortLabel.setText("Port:" + str(gLocalPort)) self.mDataPathLabel.setText("信息保存到:" + str(gSaveDataFileFullName)) # 控制台文本输出 self.mConsolePlainTextEdit = self.mUi.consolePlainTextEdit
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): self.app = QtWidgets.QApplication([]) self.about_dialog = None self.settings = Settings() QtCore.QCoreApplication.setOrganizationName("encukou"); QtCore.QCoreApplication.setOrganizationDomain("encukou.cz"); QtCore.QCoreApplication.setApplicationName("Barvocuc"); with open(get_filename('ui/mainwindow.ui'), encoding='utf-8') as f: ui_form_class, ui_base_class = uic.loadUiType(f) ui_form = ui_form_class() self.win = win = BarvocucMainWindow(ui_form) self.analysis_timer = QtCore.QTimer() self.analysis_timer.setSingleShot(False) self.analysis_timer.setInterval(100) self.analysis_timer.timeout.connect(self.do_analysis) self._analysis_position = 0 self.scenes = {} friends = [] for name in VIEWS: view = win.findChild(SynchronizedGraphicsView, 'gv_' + name) view.friends = friends friends.append(view) self.scenes[name] = self.init_graphics_scene(view) treewidget = self.win.findChild(QtWidgets.QTreeWidget, 'file_list') treewidget.itemSelectionChanged.connect(self.item_selection_changed) treewidget.header().resizeSection(0, 200) self.item_selection_changed() treewidget.setHeaderLabels(COLUMN_NAMES) treewidget.header().setSectionResizeMode( QtWidgets.QHeaderView.ResizeToContents) self.error_column_no = len(COLUMN_NAMES) - 1 self.populate_view_menu() self.populate_translation_menu() self.populate_settings_dock() self.win.findChild(QtWidgets.QDockWidget, 'dock_sobel').hide() self.win.findChild(QtWidgets.QDockWidget, 'dock_opacity').hide() settings = QtCore.QSettings() self.sync_to_settings() win.lang_changed.connect(self._lang_changed) default_locale_name = QtCore.QLocale().bcp47Name() locale_name = settings.value('barvocuc/lang', default_locale_name) self.set_locale(QtCore.QLocale(locale_name), save_setting=False) for name, func in self._action_handlers.items(): signal = self.win.findChild(QtWidgets.QAction, name).triggered signal.connect(lambda *, _func=func: _func(self))
def __init__(self, parent=None): QWidget.__init__(self, parent) Form, Base = uic.loadUiType("MyForm.ui") # Form - класс окошка в дизайнере self.form = Form() self.form.setupUi(self) # связываем объект Form(окошко) с виджетами self.form.Exit.clicked.connect(Qt.qApp.quit) # Button "Exit" self.form.Ok.clicked.connect(self.on_clicked) # Button "Ok" self.form.ModalWindow.clicked.connect(self.on_modal)
def __init__(self, parent=None): super(MeshGeneratorDialog, self).__init__(parent) form, _ = loadUiType(join(split(__file__)[0], "ui/extract.ui")) self._ui = form() self._ui.setupUi(self) self._thread = None self._mesh = None
def __init__(self, parent=None): super(MainWindow, self).__init__(parent) Ui_MainWindow, QtBaseClass = uic.loadUiType(os.path.join(base_path,"main.ui")) self.ui = Ui_MainWindow() self.ui.setupUi(self) self.fdata = [] #readed array self.ui.listWidget.itemClicked.connect(self.showComent) self.execfuncs()
def __init__(self, parent=None): QWidget.__init__(self, parent) self.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.WindowSystemMenuHint) self.setWindowModality(QtCore.Qt.WindowModal) # Блокирует первую форму Form, Base = uic.loadUiType("modalForm.ui") # Form - класс окошка в дизайнере self.form = Form() self.form.setupUi(self) self.form.Exit.clicked.connect(self.close)
def __init__(self, parent=None): QWidget.__init__(self, parent) Form, Base = uic.loadUiType("MyTdForm.ui") # Form - класс окошка в дизайнере self.form = Form() self.form.setupUi(self) # связываем объект Form(окошко) с виджетами # QPush_Buttons with button func #self.form.Exit.clicked.connect(Qt.qApp.quit) # Button "Exit" self.form.time_date_now.clicked.connect(self.date_time)
def __init__(self): log.info("ImportWindow.__init__") ui_importwindow, QtBaseClass = uic.loadUiType(qtImportWindowFile) super(ImportWindow,self).__init__() self.ui=ui_importwindow() self.ui.setupUi(self) self.ui.buttonBox.accepted.connect(self.ok) self.ui.buttonBox.rejected.connect(self.cancel)
def loadDiag(self,pyfile, uifile, json_file): self.pyfile = pyfile self.uifile = uifile self.json_file = json_file Ui_Dialog, QtBaseClass = uic.loadUiType(uifile) self.diag = Ui_Dialog() self.diag.setupUi(self)
def load_ui_factory(file_name): """ loads a ui factory """ file_path = get_file_path(path.join('ui_files', file_name)) LOGGER.debug('create factory from %s', file_name) return loadUiType(file_path)
def load_ui_from_file(name: str): """ Returns a tuple from uic.loadUiType(), loading the ui file with the given name. :param name: :return: """ ui_file = _get_ui_qfile(name) try: base_type = uic.loadUiType(ui_file, from_imports=True) finally: ui_file.close() return base_type
def __init__(self, parent=None): super(NewTaskDialogWindow,self).__init__() Ui_Dialog, QtBaseClass = uic.loadUiType('CreateCustomTask.ui') self.diag = Ui_Dialog() self.diag.setupUi(self) #connect dialog buttons self.diag.upload_python.clicked.connect(self.upload_python_clicked) self.diag.upload_ui.clicked.connect(self.upload_ui_clicked) self.diag.upload_json.clicked.connect(self.upload_json_clicked) self.diag.buttonBox.button(QDialogButtonBox.Ok).clicked.connect(self.ok_button_clicked)
def __init__(self, steps, parent=None): super(ProgressDialog, self).__init__(parent) form, _ = uic.loadUiType(split_path(__file__)[0] + "/progressDialog.ui") self.ui = form() self.ui.setupUi(self) self.steps = steps self.current = 0 self._add_pending() self.ui.cancel.clicked.connect(self.cancel) self.trigger_popup.connect(self.popup) self.trigger_update.connect(self.update_step)
def __init__(self, parent, brightfieldLedInstance): super().__init__(parent) self.brightfieldLedInstance = brightfieldLedInstance # Note that uic.loadUiType(..) returns a tuple containing two class types (the form class and the Qt base # class). The line below instantiates the form class. It is assumed that the .ui file resides in the same # directory as this .py file. self.ui = uic.loadUiType(os.path.join(os.path.dirname(__file__), 'direct_manip.ui'))[0]() self.ui.setupUi(self) self.brightfieldLedInstance.enabledChanged.connect(self.deviceEnabledChangedSlot) self.brightfieldLedInstance.powerChanged.connect(self.devicePowerChangedSlot) self.deviceEnabledChangedSlot(self.brightfieldLedInstance.enabled) self.devicePowerChangedSlot(self.brightfieldLedInstance.power)
def __init__(self,imagefile, exifCreateDate, fileModifyDate, ifnum): global manual_createDate log.info("DateTimeWindow.__init__") ui_datetimewindow, QtBaseClass = uic.loadUiType(qtDateTimeUIFile) super(DateTimeWindow,self).__init__() self.ui=ui_datetimewindow() self.ui.setupUi(self) now = datetime.datetime.today() manual_createDate = now.strftime(datetime_format) + " 12:00:00" self.ui.datetime_lineEdit.setText(manual_createDate) self.ui.incsec_lineEdit.setText(incSeconds) self.setStyleSheet(open("styles.css", "r").read())
def __init__(self): log.info("LenseApartureWindow.__init__") self.fnumber = 0 self.lensedata = [] ui_lenseapartururewindow, QtBaseClass = uic.loadUiType(qtLenseApartureUIFile) super(LenseApartureWindow,self).__init__() self.ui=ui_lenseapartururewindow() self.ui.setupUi(self) self.ui.buttonBox.accepted.connect(self.save) self.ui.buttonBox.rejected.connect(self.cancel) self.ui.lenses_comboBox.addItem("-") self.ui.lenses_comboBox.addItem("Samyang 14mm") self.ui.lenses_comboBox.addItem("Samyang 85mm") self.ui.lenses_comboBox.currentIndexChanged.connect(self.selectionchange) self.setStyleSheet(open("styles.css", "r").read())
def __init__(self, parent = None): QWidget.__init__(self, parent) Form, Base = uic.loadUiType("clientGui.ui") self.addr = "127.0.0.1" self.port = 7777 self.ui = Form() self.ui.setupUi(self) self.ui.Exit.clicked.connect(Qt.qApp.quit) self.ui.list.clicked.connect(self.showlist) self.ui.send.clicked.connect(self.sendMessage) self.serverSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.serverSocket.connect((self.addr, self.port)) select.select([self.serverSocket], [self.serverSocket], []) self.sing.connect(self.fillForm) thread = ThreadReader(self.serverSocket, self.sing) thread.start()
def __init__(self, video_maker): super().__init__() # Note that uic.loadUiType(..) returns a tuple containing two class types (the form class and the Qt base # class). The line below instantiates the form class. It is assumed that the .ui file resides in the same # directory as this .py file. self.ui = uic.loadUiType(str(Path(__file__).parent / 'extensible_video_maker.ui'))[0]() self.ui.setupUi(self) self.video_maker = video_maker video_maker.frame_index_changed.connect(lambda idx: self.ui.frame_index_widget.display(idx)) self.ui.start_stop_button.clicked.connect(self.on_start_stop) video_maker.started_changed.connect(self.on_started_changed) self.ui.pause_resume_button.clicked.connect(self.on_pause_resume) video_maker.paused_changed.connect(self.on_paused_changed) self.ui.write_output_checkbox.toggled.connect(self.on_write_output_toggled) video_maker.write_output_changed.connect(self.on_write_output_changed) self.ui.status_label.setVisible(False) video_maker.operation_completed.connect(self.on_operation_completed)
def __init__(self, parent=None): super(PCRTaskDialogWindow,self).__init__() Ui_Dialog, QtBaseClass = uic.loadUiType('TaskDialogBox.ui') self.diag = Ui_Dialog() self.diag.setupUi(self) self.samples = self.diag.samples_doubleSpinBox self.samples.setRange(0,100) self.samples.setSingleStep(1) self.samples.setValue(0) self.primer = self.diag.primer_SpinBox self.primer.setRange(0,100) self.primer.setSingleStep(1) self.primer.setValue(0) #when okay button is clicked workspace config pops up and data should be sent back to main self.diag.task_diag_buttonBox.button(QDialogButtonBox.Ok).clicked.connect(self.ok_button_clicked)
def __init__(self, parent=None): super(TCPServerInfoWidget, self).__init__(parent) ui_class, widget_class = uic.loadUiType(os.path.split(__file__)[0] + "/tcpServerInfoWidget.ui") self.ui = ui_class() self.ui.setupUi(self) self.server_status = { "port": None, "running": False } self.ui.toggleStatus.clicked.connect(partial(self.ui.toggleStatus.setEnabled, False)) self.ui.toggleStatus.clicked.connect(self.statusToggled.emit) menu = QMenu("options") self.change_port_action = menu.addAction("Change Port", self.changePort.emit) self.ui.toggleStatus.setMenu(menu) self.status_style = "background-color: %s; border: 3px inset gray"
def show_about(self, pageno): if self.about_dialog: dialog = self.about_dialog else: with open(get_filename('ui/about.ui')) as f: form, cls = uic.loadUiType(f) dialog = self.about_dialog = AboutDialog(form()) with open(get_filename('COPYING.html')) as f: license_html = f.read() widget = dialog.findChild(QtWidgets.QTextBrowser, 'textLicense') widget.setHtml(license_html) widget = dialog.findChild(QtWidgets.QTabWidget, 'tabWidget') widget.setCurrentIndex(pageno) dialog.show() dialog.raise_()
def setup_ui(self): # Load the Qt Designer .ui file Ui_FrameWindow, QMainWindow = uic.loadUiType(UI_FILE) log.debug("Built frame window using uic") # Create the UI elements self.window = QtWidgets.QMainWindow() self.ui = Ui_FrameWindow() self.ui.setupUi(self.window) # Add labels to the HDF Tree widget self.ui.hdfTree.setHeaderLabels(['Name', 'Type']) header = self.ui.hdfTree.header() header.setSectionResizeMode(0, QtWidgets.QHeaderView.Stretch) header.setStretchLastSection(False) # Connect the signal for drawing the frames, histogram, etc. self.create_canvas() # Create animations from the collected artists self.source = FrameChangeSource(view=self) # Connect UI signals to view signals self.ui.sldFrameSlider.valueChanged.connect(self.frame_slider_moved) self.ui.btnApplyLimits.clicked.connect(self.request_new_vrange) self.ui.btnResetLimits.clicked.connect(self.reset_vrange_requested) self.ui.cmbTimestep.currentIndexChanged.connect(self.new_timestep_requested) self.ui.cmbCmap.currentTextChanged.connect(self.new_cmap_requested) self.ui.cmbComponent.currentTextChanged.connect(self.new_component_requested) self.ui.btnPlay.toggled.connect(self.play_button_clicked) self.ui.btnForward.clicked.connect(self.forward_button_clicked) self.ui.btnBack.clicked.connect(self.back_button_clicked) self.ui.btnFirst.clicked.connect(self.first_button_clicked) self.ui.btnLast.clicked.connect(self.last_button_clicked) self.ui.sldPlaySpeed.valueChanged.connect(self.play_speed_requested) self.ui.hdfTree.currentItemChanged.connect(self.new_hdf_group_requested) self.ui.actionOpen.triggered.connect(self.new_hdf_file_requested) # Emit a signal when mouse hovers over the figure def hover_frame(event): if event.inaxes is self.img_ax: xy = xycoord(x=event.xdata, y=event.ydata) else: xy = None self.figure_hovered.emit(xy) self.fig.canvas.mpl_connect('motion_notify_event', hover_frame) # Launch the actual window itself self.window.show()
# California, through Lawrence Berkeley National Laboratory, Battelle Memorial # Institute, Pacific Northwest Division through Pacific Northwest National # Laboratory, Carnegie Mellon University, West Virginia University, Boston # University, the Trustees of Princeton University, The University of Texas at # Austin, URS Energy & Construction, Inc., et al. All rights reserved. # # Please see the file LICENSE.md for full copyright and license information, # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". # ############################################################################### import os from PyQt5 import uic, QtCore mypath = os.path.dirname(__file__) _saveMetadataDialogUI, _saveMetadataDialog = \ uic.loadUiType(os.path.join(mypath, "saveMetadataDialog_UI.ui")) #super(, self).__init__(parent=parent) class saveMetadataDialog(_saveMetadataDialog, _saveMetadataDialogUI): sendTag = QtCore.pyqtSignal() def __init__(self, dat, parent=None): ''' Constructor for model setup dialog ''' super(saveMetadataDialog, self).__init__(parent=parent) self.setupUi(self) # Create the widgets self.cancelButton.clicked.connect(self.reject) self.continueButton.clicked.connect(self.accept)
from PyQt5.uic import loadUiType import ROV_rc import time import os from os import path import sys import serial ser = serial.Serial("COM11", 9600) time.sleep(1) FORM_CLASS, _ = loadUiType(path.join(path.dirname(__file__), "main.ui")) class MainApp(QMainWindow, FORM_CLASS): def __init__(self, parent=None): super(MainApp, self).__init__(parent) QMainWindow.__init__(self) self.setupUi(self) self.A_button() self.B_button() self.up_button() self.down_button() self.right_button() self.left_button() self.rt_button() self.stop_button()
""" QtDesigner로 만든 UI와 해당 UI의 위젯에서 발생하는 이벤트를 컨트롤하는 클래스 author: 서경동 last edit: 2017. 01. 18 """ import sys, time from PyQt5.QtWidgets import QApplication, QMainWindow, QMessageBox, QTableWidget, QTableWidgetItem from PyQt5.QtCore import Qt, QTimer, QTime from PyQt5 import uic from Kiwoom import Kiwoom, ParameterTypeError, ParameterValueError, KiwoomProcessingError, KiwoomConnectError ui = uic.loadUiType("pytrader.ui")[0] class MyWindow(QMainWindow, ui): def __init__(self): super().__init__() self.setupUi(self) self.show() self.kiwoom = Kiwoom() self.kiwoom.commConnect() self.server = self.kiwoom.getLoginInfo("GetServerGubun") if len(self.server) == 0 or self.server != "1": self.serverGubun = "실제운영" else: self.serverGubun = "모의투자"
from PyQt5.QtWidgets import QDialog except: from PyQt4 import QtGui, uic from PyQt4.QtCore import QDir from PyQt4.QtGui import QDialog try: from fnc4all import * from fnc4SaxonyCadastralParcels import * except: from .fnc4all import * from .fnc4SaxonyCadastralParcels import * d = os.path.dirname(__file__) QDir.addSearchPath("SaxonyCadastralParcels", d) uiAboutBase = uic.loadUiType(os.path.join(d, 'uiAbout.ui'))[0] FORM_CLASS, _ = uic.loadUiType( os.path.join(os.path.dirname(__file__), 'uiAbout.ui')) class uiAbout(QDialog, FORM_CLASS): def __init__(self, parent=None): super(uiAbout, self).__init__(parent) self.setupUi(self) s = self.lblLink.text() s = s.replace( "$$Homepage$$",
import sys from PyQt5 import QtCore, QtGui, QtWidgets, uic import controller from datetime import date, datetime, timezone qt_tela_inicial = "telas/gerenciar_meta.ui" Ui_MainWindow, QtBaseClass = uic.loadUiType(qt_tela_inicial) class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): switch_tela_gerenciar_meta = QtCore.pyqtSignal() def __init__(self, id_meta): QtWidgets.QMainWindow.__init__(self) Ui_MainWindow.__init__(self) self.setupUi(self) self.meta_atual = controller.select_meta_completa(id_meta) self.carregar_dados_meta(id_meta) data_hoje = str(date.today()) data_hoje = QtCore.QDate.fromString(data_hoje, 'yyyy-MM-dd') self.date_dt_inicial.setDate(data_hoje) self.date_dt_final.setDate(data_hoje) self.btn_cadastrar.pressed.connect(self.cadastrar) self.btn_limpar.pressed.connect(self.limpar) self.btn_sair.pressed.connect(self.sair)
x1, y1, x2, y2 = 0, 0, 640, 480 a1, b1, a2, b2 = 0, 0, 640, 480 c1, d1, c2, d2 = 0, 0, 640, 480 i = 1 ic, jc, kc = True, True, True red, green, blue = True, False, False path = 'C:/Users/Palmstrom Lab/Desktop/FRHEED/' filename = 'default' #### Define colormap #### cmp = Colormap() FRHEEDcmap = cmp.cmap_linear('black', 'green', 'white') cm.register_cmap(name='RHEEDgreen', cmap=FRHEEDcmap) cmap = FRHEEDcmap #cmp.test_colormap(FRHEEDcmap) #### Loading UI file from qt designer #### form_class = uic.loadUiType("FRHEED.ui")[0] #### Define "shortcut" for queue #### q = queue.Queue() #### Define video recording codec #### fourcc = cv2.VideoWriter_fourcc('M', 'J', 'P', 'G') #### Set default appearance of plots #### pg.setConfigOption('background', 'w') pg.setConfigOption('foreground', 0.0) #### Connect to RHEED camera #### system = PySpin.System.GetInstance() cam_list = system.GetCameras() cam = cam_list.GetBySerial("18434385") nodemap_tldevice = cam.GetTLDeviceNodeMap() cam.Init() cam.ExposureAuto.SetValue(PySpin.ExposureAuto_Off) cam.ExposureTime.SetValue(exposure) # exposure time in microseconds
from PyQt5 import uic from PyQt5.QtGui import * import subway_resource.geoLine as line import subway_resource.linkData as link import subway_resource.nodeData as node import os.path from collections import defaultdict import math from heapq import heapify, heappush, heappop INF = 99999999 File_path = "w2/output.txt" # UI파일 연결 # 단, UI파일은 Python 코드 파일과 같은 디렉토리에 위치해야한다. form_class = uic.loadUiType("mainUI.ui")[0] # 화면을 띄우는데 사용되는 Class 선언 class Main_WindowClass(QMainWindow, form_class): result = list() def __init__(self): super().__init__() self.setupUi(self) # QPixmap 객체 생성 후 이미지 파일을 이용하여 QPixmap에 사진 데이터 Load하고, Label을 이용하여 화면에 표시 # self.qPixmapFileVar = QPixmap() # self.qPixmapFileVar.load("subway.png") # self.qPixmapFileVar = self.qPixmapFileVar.scaledToWidth(1286) # self.lbl_picture.setPixmap(self.qPixmapFileVar)
from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * from PyQt5.uic import loadUiType import sys, time, fwvulcode_multi, fwvulcode_single ui, _ = loadUiType('fwvul.ui') class MainApp(QMainWindow, ui): def __init__(self): QMainWindow.__init__(self) self.title = "Pignus Framework Vulnerability Detector v0.03 by t0xic0der" self.setupUi(self) self.handle_elements() def handle_elements(self): self.setWindowTitle(self.title) self.det_boxer.setReadOnly(True) self.btn_scan_one.clicked.connect(self.fetch_one) self.btn_scan_mul.clicked.connect(self.fetch_mul) def fetch_one(self): url = self.edit_one.text() try: self.det_boxer.clear() start_time = time.time() result = fwvulcode_single.analyze(url) end_time = time.time() total_time = str((end_time - start_time) / 60) time_array = total_time.split(".")
# University, the Trustees of Princeton University, The University of Texas at # Austin, URS Energy & Construction, Inc., et al. All rights reserved. # # Please see the file LICENSE.md for full copyright and license information, # respectively. This file is also available online at the URL # "https://github.com/CCSI-Toolset/FOQUS". # ############################################################################### import sys import os from PyQt5 import uic from PyQt5.QtWidgets import QApplication, QMainWindow mypath = os.path.dirname(__file__) _basicDataParentFrameUI, _basicDataParentFrame = \ uic.loadUiType(os.path.join(mypath, "basicDataParentFrame_UI.ui")) class basicDataParentFrame(_basicDataParentFrame, _basicDataParentFrameUI): format = '%.5f' # numeric format for table entries in UQ Toolbox def __init__(self, parent=None): super(basicDataParentFrame, self).__init__(parent) self.parent = parent self.setupUi(self) self.dmfGroup.hide() self.solventFitFrame.init(parent=self) if __name__ == "__main__": app = QApplication(sys.argv)
import logging import traceback from shutil import copy # PyQt5 Imports from PyQt5 import uic from PyQt5.QtWidgets import QWidget # Own Imports from kmap import __directory__ from kmap.model.colormap_model import ColormapModel from kmap.config.config import config # Load .ui File UI_file = __directory__ / 'ui/colormap.ui' Colormap_UI, _ = uic.loadUiType(UI_file) class Colormap(QWidget, Colormap_UI): def __init__(self, plot_item): # Setup GUI super(Colormap, self).__init__() self.setupUi(self) self._connect() self.path = self.get_path() self.model = ColormapModel(plot_item) self.load_colormaps()
import math import time import re import pycrafter4500 from textprocess import TextProcess from client import Client from motormanager import MotorManager from PyQt5 import uic from PyQt5.QtCore import QFile, QRegExp from PyQt5.QtWidgets import QApplication, QFileDialog, QMainWindow, QMenu, QMessageBox #========================================================= # a class that handles the signal and callbacks of the GUI #========================================================= # UI config qtCreatorFile = "mainwindow.ui" Ui_MainWindow, QtBaseClass = uic.loadUiType(qtCreatorFile) client = Client() mm = MotorManager(client) tp = TextProcess(client, mm) #========================================================= # a class that handles the signal and callbacks of the GUI #========================================================= class GUI(QMainWindow, Ui_MainWindow): def __init__(self): QMainWindow.__init__(self) Ui_MainWindow.__init__(self) self.setupUi(self)
from PyQt5.QtCore import Qt from PyQt5 import uic from PyQt5.QtWidgets import (QMainWindow, QApplication, QGridLayout, QLayout, QLineEdit, QSizePolicy, QToolButton, QWidget) import cv2 from PIL import Image import os.path from PyQt5.QtWidgets import QApplication, QFileSystemModel, QTreeView, QWidget, QVBoxLayout from PyQt5.QtGui import QIcon FormUi = uic.loadUiType("ImageEdit.ui")[0] class SearchDir(QWidget): def __init__(self): super().__init__() self.title = '' self.initUI() def initUI(self): self.model = QFileSystemModel() self.model.setRootPath('') self.tree = QTreeView() self.tree.setModel(self.model) self.tree.setAnimated(False) self.tree.setIndentation(20) self.tree.setSortingEnabled(True) windowLayout = QVBoxLayout()
#!/usr/bin/python3 from PyQt5.QtWidgets import QWizard, QApplication, QWizardPage from PyQt5.QtCore import pyqtSlot, pyqtSignal from common.dmscanner import Scanner from PyQt5.uic import loadUiType from hradccalib import HRADCCalib import serial import glob import sys UI_PATH = 'wizard.ui' Ui_Class, base = loadUiType(UI_PATH) class HRADCWindow(QWizard, Ui_Class): # Page numbers (num_intro_page, num_serial_number, num_connect_hradc, num_serial_port, num_start_test) = range(5) def __init__(self, parent=None): QWizard.__init__(self, parent) self.setupUi(self) self._SERIAL_BAUDRATE = 6000000 self._list_serial_ports() self._serial_port_status = False self._test_serial_port_status = False self._test_thread = HRADCCalib()
uifile_0 = os.path.join("start_window.ui") # Enter file here. uifile_1 = os.path.join("About.ui") # Enter file here. uifile_2 = os.path.join("Help.ui") # Enter file here. uifile_3 = os.path.join("input_window.ui") # Enter file here. uifile_4 = os.path.join("saaa.ui") # Enter file here. #styles css_filepath = os.path.join("css.css") form_0, base_0 = uic.loadUiType(uifile_0) form_1, base_1 = uic.loadUiType(uifile_1) form_2, base_2 = uic.loadUiType(uifile_2) form_3, base_3 = uic.loadUiType(uifile_3) form_4, base_4 = uic.loadUiType(uifile_4) class CssMainWindow(QMainWindow): def __init__(self, css_filepath): super().__init__() ##http://doc.crossplatform.ru/qt/4.5.0/stylesheet-reference.html #set stylesheet f = open(css_filepath, 'r') css_string = f.read() f.closed self.setStyleSheet(css_string)
QtDesigner로 만든 UI와 해당 UI의 위젯에서 발생하는 이벤트를 컨트롤하는 클래스 author: Jongyeol Yang last edit: 2017. 02. 23 """ import sys, time from PyQt5.QtWidgets import QApplication, QMainWindow, QMessageBox, QTableWidget, QTableWidgetItem from PyQt5.QtCore import Qt, QTimer, QTime from PyQt5 import uic from pykiwoom.kiwoom import * from pykiwoom.wrapper import * import codecs form_class = uic.loadUiType("pytrader.ui")[0] class MyWindow(QMainWindow, form_class): def __init__(self): super().__init__() self.setupUi(self) self.show() self.kiwoom = Kiwoom() self.kiwoom.comm_connect() self.wrapper = KiwoomWrapper(self.kiwoom) if self.kiwoom.get_login_info("GetServerGubun"): self.server_gubun = "모의투자" else: self.server_gubun = "실제투자"
from PyQt5 import uic from CreateChatMacro import CreateChatThread from DBHelper import * from LoginMacro import ValidateAccountThread import sys import logging import time import os logger = logging.getLogger() FORMAT = "[%(asctime)s][%(filename)s:%(lineno)3s - %(funcName)20s()] %(message)s" logging.basicConfig(format=FORMAT, filename=f'./log/{time.strftime("%Y-%m-%d")}.log') logger.setLevel(logging.INFO) form_class = uic.loadUiType(os.path.abspath("./ui/create_chat_macro_v2.ui"))[0] class MyWindow(QMainWindow, form_class): """ 시그널 ::START:: """ state_validation_finished = pyqtSignal() state_identification_finished = pyqtSignal() """ ::END:: """ """ 변수
***************************************************************************/ /*************************************************************************** * * * 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 PyQt5 import QtWidgets, uic FORM_CLASS, _ = uic.loadUiType( os.path.join(os.path.dirname(__file__), 'table_managment.ui')) class TableMgmtDialog(QtWidgets.QDialog, FORM_CLASS): def __init__(self, parent=None): """Constructor.""" super(TableMgmtDialog, 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)
except socket_error: raise rospy.ROSInitException( 'Cannot load QGIS ROS. ROS Master was not found.') else: rospy.init_node('qgis_ros_toolbox') from functools import partial from pathlib import Path import os from PyQt5 import uic, QtCore, QtWidgets from qgis.core import QgsProject import rospy from ..core import TranslatorRegistry FORM_CLASS, _ = uic.loadUiType( str(Path(os.path.dirname(__file__)) / 'data_loader_widget.ui')) class DataLoaderWidget(QtWidgets.QWidget, FORM_CLASS): def __init__(self, parent=None): '''Occurs on init, even if dialog is not shown.''' super(DataLoaderWidget, self).__init__(parent) self.setupUi(self) self.topicList.currentItemChanged.connect(self._onTopicListChange) self.createLayerButton.clicked.connect(self._onCreateLayer) self.subscribeButton.clicked.connect( partial(self._onCreateLayer, subscribe=True)) self._selectedTopicName = None
* (at your option) any later version. * * * ***************************************************************************/ """ import os import requests from PyQt5.uic import loadUiType from PyQt5.QtWidgets import QDialog, QMessageBox from PyQt5.QtCore import QSettings from APIS.src.apis_utils import SetWindowSize, GetWindowSize FORM_CLASS, _ = loadUiType(os.path.join( os.path.dirname(os.path.dirname(__file__)), 'ui', 'apis_overpass_request.ui'), resource_suffix='') class APISOverpassRequest(QDialog, FORM_CLASS): def __init__(self, parent=None): """Constructor.""" super(APISOverpassRequest, self).__init__(parent) self.setupUi(self) if GetWindowSize("overpass_request"): self.resize(GetWindowSize("overpass_request")) self.lon = None self.lat = None
#!/usr/bin/env python3 import sys import os import subprocess import logging from PyQt5 import QtWidgets, uic, QtCore, QtGui from PyQt5.QtWidgets import QFileSystemModel from PyQt5.QtCore import QFileSystemWatcher, Qt from model import Model from lxml import etree LogViewerWindow = "./Design/LogViewer.ui" Ui_MainWindow, QtBaseClass = uic.loadUiType(LogViewerWindow) # ----------------------------------------------------------------------------- class LogViewer(QtWidgets.QMainWindow, Ui_MainWindow): # ----------------------------------------------------------------------------- def __init__(self, argv): logging.basicConfig(filename='trace.log', level=logging.DEBUG) self.changeDetection = False self.app = QtWidgets.QApplication(argv) QtWidgets.QMainWindow.__init__(self) Ui_MainWindow.__init__(self) self.model = Model() self.setupUi(self)
from PyQt5.QtWidgets import * from PyQt5.QtCore import * from PyQt5 import uic import pybithumb import sys form_class=uic.loadUiType("window.ui")[0] class myWindow(QMainWindow,form_class): def __init__(self): super().__init__() self.setupUi(self) self.timer=QTimer(self) self.timer.start(1000) self.coin = "" self.comboBox.addItems(pybithumb.get_tickers()) self.comboBox.currentIndexChanged.connect(self.changeCoin) self.pastPrice = pybithumb.get_current_price(self.coin) self.btnStart.clicked.connect(self.btn_start) self.btnStop.clicked.connect(self.btn_stop)
from pathlib import Path from PyQt5.uic import loadUiType from ..Shared import Tab_Page_Widget from Framework import Live_Editor from .Edit_Tree_Model import Edit_Tree_Model from .Edit_Table_Model import Edit_Table_Model gui_file = Path(__file__).parents[1] / 'x4c_gui_viewer_tab.ui' generated_class, qt_base_class = loadUiType(str(gui_file)) class Edit_View_Window(Tab_Page_Widget, generated_class): ''' Window used for editing table data, aiming to use the qt model/view objects to get better formatting than custom made widgets. Intended to be replicated across multiple tabs for different table groups. Widget names: * widget_treeView * widget_tableView * hsplitter * widget_Hideme * widget_Table_Update * widget_table_checkBox_0 * widget_table_checkBox_1 * widget_table_checkBox_2 * widget_table_checkBox_3 * button_view_object
from queue import Queue from threading import Thread from command import command from command import make_moz_cmd_list, make_tbb_cmd_list, make_copy_cmd_list, cmd_cmd_list, exit_cmd_list, watch_cmd_list import file_open_easygui as fopen from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import uic from tkinter import Tk, Listbox, Label # import .ui file # .ui file must be located in the same directory as the Python code file. form_class = uic.loadUiType("CC_Server_GUI.ui")[0] print("Running in: ", os.getcwd()) class CommandSerize9999(Thread): def __init__(self, queue, ip_addr): Thread.__init__(self) self.queue = queue self.ip_addr = ip_addr self.port = "9999" def run(self): while True: command_list = self.queue.get() if command_list is None:
import sys from PyQt5.QtWidgets import * from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5 import uic form_class = uic.loadUiType("webEngineViewTest.ui")[0] class WindowClass(QMainWindow, form_class): def __init__(self): super().__init__() self.setupUi(self) #WebEngineView의 시그널 self.webEngineView_Test.loadStarted.connect(self.printLoadStart) self.webEngineView_Test.loadProgress.connect(self.printLoading) self.webEngineView_Test.loadFinished.connect(self.printLoadFinished) self.webEngineView_Test.urlChanged.connect(self.urlChangedFunction) #버튼들에 기능을 연결 self.btn_setUrl.clicked.connect(self.urlGo) self.btn_back.clicked.connect(self.btnBackFunc) self.btn_forward.clicked.connect(self.btnForwardFunc) self.btn_reload.clicked.connect(self.btnRelaodFunc) self.btn_stop.clicked.connect(self.btnStopFunc) #WebEngineView의 시그널에 연결된 함수들 def printLoadStart(self): print("Start Loading")
import sys import json import time import pickle import numpy as np from PyQt5 import QtWidgets, uic from nenetic.workers import Extractor from nenetic.workers import FcTrainer from nenetic.workers import ConvTrainer from nenetic.workers import Classifier bundle_dir = os.path.dirname(__file__) if getattr(sys, 'frozen', False): bundle_dir = sys._MEIPASS CLASS_DIALOG, _ = uic.loadUiType(os.path.join(bundle_dir, 'toolkit_widget.ui')) class ToolkitWidget(QtWidgets.QDialog, CLASS_DIALOG): def __init__(self, canvas, parent=None): QtWidgets.QDialog.__init__(self, parent) self.setupUi(self) self.canvas = canvas self.training_data = None self.directory = None self.extractor = None self.fc_trainer = None self.conv_trainer = None self.classifier = Classifier() self.classifier.feedback.connect(self.log)
import sys from PyQt5 import QtGui, QtCore, QtWidgets, uic Ui_MainWindow, MainWindowBase = uic.loadUiType('MainWindow.ui') import numpy as np from vispy import scene from examples.gui.custom_plot_widget import CustomPlotWidget, LabelText n_size = 1000000 x = np.linspace(0, 50, n_size) data_model = { "dataset a": { "x": x, "y": np.sin(x) }, "dataset b": { "x": x, "y": np.cos(x) } } # control plot visibility with checkboxes class MainWindow(MainWindowBase): def __init__(self): MainWindowBase.__init__(self) self.ui = Ui_MainWindow()
* (at your option) any later version. * * * ***************************************************************************/ """ import os import pandas as pd from PyQt5 import QtWidgets, QtCore from PyQt5 import uic from PyQt5.QtWidgets import QFileDialog, QMessageBox, QTableWidgetItem from qgis.core import QgsProject # This loads your .ui file so that PyQt can populate your plugin with the elements from Qt Designer FORM_CLASS, _ = uic.loadUiType( os.path.join(os.path.dirname(__file__), 'RegressionAnalysis_dialog_base.ui')) class RegressionAnalysisDialog(QtWidgets.QDialog, FORM_CLASS): fieldnames = None # saves fieldnames input_path = None # saves input path separator = ";" # saves the separator, defaults to ";" df = None # saves the input csv as a pandas DataFrame def __init__(self, parent=None): """Constructor.""" super(RegressionAnalysisDialog, self).__init__(parent) # Set up the user interface from Designer through FORM_CLASS. # After self.setupUi() you can access any designer object by doing # self.<objectname>, and you can use autoconnect slots - see
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with with this software. If not, see <http://www.gnu.org/licenses/>. # # -------------------------------------------------------------------------- import os import sys from PyQt5 import QtCore, QtGui, QtWidgets, uic # from .ui_point_widget import Ui_Pointwidget as WIDGET if getattr(sys, 'frozen', False): bundle_dir = sys._MEIPASS else: bundle_dir = os.path.dirname(__file__) WIDGET, _ = uic.loadUiType(os.path.join(bundle_dir, 'point_widget.ui')) class PointWidget(QtWidgets.QWidget, WIDGET): def __init__(self, canvas, parent=None): QtWidgets.QWidget.__init__(self, parent) self.setupUi(self) self.canvas = canvas self.pushButtonAddClass.clicked.connect(self.add_class) self.pushButtonRemoveClass.clicked.connect(self.remove_class) self.pushButtonImport.clicked.connect(self.import_metadata) self.pushButtonSave.clicked.connect(self.save) self.pushButtonLoadPoints.clicked.connect(self.load) self.pushButtonReset.clicked.connect(self.reset) self.pushButtonExport.clicked.connect(self.export)
import re import time import datetime from PyQt5.uic import loadUiType from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * from db_User import * from db_ClassRoom import * from db_Event import * from Login import * from SetTheme import * userapp, _ = loadUiType('../ui/MMKSystem.ui') class UserApp(QMainWindow, userapp): quan_dict = { 0: "", 1: "第1-2节课", 2: "第3-5节课", 3: "第6-7节课", 4: "第8-9节课", } status_dict = {0: "待审核", 1: "已通过", 2: "已过期"} def __init__(self, acc): self.acc = acc QWidget.__init__(self)
import json import threading import subprocess import os import sys if getattr(sys, 'frozen', False): qt_creator_file = os.path.join(sys._MEIPASS, "command.ui") default_project = os.path.join(sys._MEIPASS, "test") else: qt_creator_file = "command.ui" default_project = "test" Ui_MainWindow, QtBaseClass = uic.loadUiType(qt_creator_file) class TodoModel(QtCore.QAbstractListModel): def __init__(self, *args, project=None, **kwargs): super(TodoModel, self).__init__(*args, **kwargs) self.project = project self.commands = [] for fn in glob.glob("{}/*.ci".format(project)): bn = os.path.basename(fn) self.commands.append(bn.replace(".ci", "")) def add_data(self, n): if n: self.beginInsertRows(QtCore.QModelIndex(), len(self.commands), len(self.commands))