def __init__(self, ui_file, parent=None): #setup form trying something super(Form, self).__init__(parent) ui_file = QFile(ui_file) ui_file.open(QFile.ReadOnly) loader = QUiLoader() self.window = loader.load(ui_file) ui_file.close() ################################# # Globals self.ftoken = self.window.line_ftoken self.stepsize = self.window.cbox_stepsize self.duration = self.window.cbox_duration self.runloc = self.window.cbox_runloc self.to_export = self.window.list_toexport self.to_attrs = self.window.list_attrs self.attr = self.window.line_attr # Buttons btn_export = self.window.btn_export btn_export.clicked.connect(self.export_handler) btn_cancel = self.window.btn_cancel btn_cancel.clicked.connect(self.cancel_handler) btn_addattr = self.window.btn_addattr btn_addattr.clicked.connect(self.addattr_handler) btn_removeattr = self.window.btn_removeattr btn_removeattr.clicked.connect(self.removeattr_handler) # Misc signals self.attr.returnPressed.connect(self.addattr_handler) #Run defaults self.set_defaults() #Show window self.window.show()
def __init__(self, ui_file, parent=None): super(StartWindow, self).__init__(parent) global npc_obj, all_npcs, display_npcs, npc_names, campaigns ui_file = QFile(ui_file) ui_file.open(QFile.ReadOnly) loader = QUiLoader() self.main_window = loader.load(ui_file) self.main_window.setWindowTitle("NPC Manager") ui_file.close() add_button = self.main_window.findChild(QPushButton, 'add_button') add_button.clicked.connect(self.load_json_file) # Campaign Drop down campaigns = ["All"] display_npcs = [] for npc in all_npcs: display_npcs.append(npc) self.campaign_list = self.main_window.findChild( QComboBox, 'campaign_list') self.campaign_list.insertItems(0, campaigns) self.campaign_list.currentIndexChanged.connect(self.load_npc_list) # NPC Drop down npc_names = [] for npc in all_npcs: npc_names.append(npc["name"]) npc_list = self.main_window.findChild(QComboBox, 'npc_list') npc_list.insertItems(0, npc_names) npc_list.currentIndexChanged.connect(self.load_npc_info) # Arrows next_button = self.main_window.findChild(QPushButton, 'next_button') next_button.clicked.connect(self.next_card) previous_button = self.main_window.findChild(QPushButton, 'previous_button') previous_button.clicked.connect(self.previous_card)
def adtocart1(codnum2): connectionStock4 = MySQLdb.connect(host='xxxxxxxxxxxx', port=3336, database='xxxxStock', user='******', password='******') QueryprodC4 = """SELECT codigo, nombre, PrecioDetal FROM stockRioCuarto WHERE codigo=""" + str(codnum2) + """;""" cursorQp4 = connectionStock4.cursor() cursorQp4.execute(QueryprodC4) # print(result) connectionStock4.commit() recordst4 = cursorQp4.fetchall() recordst5 = recordst4[int(int(len(recordst4)) - int(1))] cursorQp4.close() print(recordst5) for i in range(1): cartwfile = QFile("proddesglowidget.ui") cartwfile.open(QFile.ReadOnly) cartloader = QUiLoader() cartwwindow = cartloader.load(cartwfile) tam3 = QSize() tam3.setHeight(44) tam3.setWidth(963) itemN3 = QtWidgets.QListWidgetItem() itemN3.setSizeHint(tam3) Codpros3 = cartwwindow.findChild(QLabel, 'codn2') Nombpros3 = cartwwindow.findChild(QLabel, 'nomp2') pricest3 = cartwwindow.findChild(QLabel, 'preciow2') cantvprod3= cartwwindow.findChild(QSpinBox, 'cantidadp2') Codpros3.setText(str(recordst5[0])) Nombpros3.setText(str(recordst5[1])) pricest3.setText(str(recordst5[2])) Desgloselis1.addItem(itemN3) print('sfsaf') Desgloselis1.setItemWidget(itemN3, cartwwindow)
def __init__(self): # 从文件中加载UI定义 # 从 UI 定义中动态 创建一个相应的窗口对象 # 注意:里面的控件对象也成为窗口对象的属性了 # 比如 self.ui.button , self.ui.textEdit self.isLegal = False #检查学生信息是否合法,初始认为不合法 self.stuID = "" # 学生编号 self.stuName = "" # 学生姓名 self.stuBDIP = "" #学生在JSON中记录的,允许登录的合法IP self.stuIsCT = False #学生是否C++程序班成员 self.stuPWD = "" #学生登录密码 self.stuDBPWD = "" #学生在JSON中记录的密码 self.stuIsLock = True #默认锁定IP登录 self.stuPCname = socket.getfqdn(socket.gethostname()) # 获取电脑名称 写入日志 self.stuIP = socket.gethostbyname(self.stuPCname) # 获取电脑IP地址 写入日志 self.ui = QUiLoader().load('ui/netDiskClientWdw.ui') self.ui.checkBTN.clicked.connect(self.checkNum) self.ui.loginBTN.clicked.connect(self.goOpen) self.ui.cancelBTN.clicked.connect(self.closeWdw) self.ui.stuPWD.setVisible(False) self.ui.chgPWD.setVisible(False)
def __init__(self, parent=None): super(TrackerWidget, self).__init__(parent) base_dir = os.path.dirname(os.path.realpath(__file__)) ui_dir = os.path.join(base_dir, 'forms', 'tracker_widget.ui') file = QFile(ui_dir) file.open(QFile.ReadOnly) loader = QUiLoader() self.widget = loader.load(file, self) file.close() self.setMinimumSize(460, 220) self.setMaximumSize(16777215, 220) self.widget.cbTrackedObject.addItem('') self.widget.cbReferenceObject.addItem('Camera') self.widget.cbTrackedObject.currentIndexChanged.connect( self.reset_labels) self.widget.cbReferenceObject.currentIndexChanged.connect( self.reset_reference_labels)
def gui(qt, ui_file, title): # uiファイルのロード loader = QUiLoader() ui = loader.load(ui_file) size = get_ui_size(ui_file) try: qt.setCentralWidget(ui) except AttributeError: layout = QVBoxLayout() layout.addWidget(ui) qt.setLayout(layout) size[0] += 20 size[1] += 20 # ウィンドウのタイトルとサイズを設定 qt.setWindowTitle(title) qt.setFixedSize(size[0], size[1]) return ui
def __init__(self): # 在线客户端 self.online_pool = {} self.listenSocket_class = server() #窗体类服务器对象,这种写法在窗体类创建时自动创建服务类 self.listenSocket = self.listenSocket_class.start_server() # 从文件中加载UI定义 # 从 UI 定义中动态 创建一个相应的窗口对象 # 注意:里面的控件对象也成为窗口对象的属性了 self.ui = QUiLoader().load("server_UI.ui") # 实例化 self.ms = MySignals() # 自定义信号的处理函数 self.ms.text_print.connect(self.printToGui) IP1 = 'IP:' + config.IP PORT1 = 'PORT:' + str(config.PORT) self.ui.plainTextEdit_2.setPlainText(IP1) self.ui.port_txt.setPlainText(PORT1) self.ui.pushButton.clicked.connect(self.handels)
def __init__(self): qfile = QFile('main.ui') qfile.open(qfile.ReadOnly) qfile.close() self.ui = QUiLoader().load(qfile) self.ui.setWindowTitle('excigin') # self.ui.openfilebutton.clicked.connect(self.openfilebutton) # self.ui.savefilebutton.clicked.connect(self.savefilebutton) self.ui.actionopen.triggered.connect(self.openfilebutton) self.ui.actionsave.triggered.connect(self.savefilebutton) self.ui.operation_button.clicked.connect(self.startbutton) # 行列基本运算 self.ui.eval_button.clicked.connect(self.evalbutton) # 行列最大值等 self.ui.pic_button.clicked.connect(self.picbutton) self.ui.filter_button.clicked.connect(self.filterbutton) self.ui.section_button.clicked.connect(self.sectionbutton) self.file = None self.isnull = None self.pic_show = QWebEngineView() # 图片预览框 self.ui.pic_show_layout.addWidget(self.pic_show)
def show_dock_theme(self, parent): """""" self.colors = ['primaryColor', 'primaryLightColor', 'secondaryColor', 'secondaryLightColor', 'secondaryDarkColor', 'primaryTextColor', 'secondaryTextColor'] self.custom_colors = {v: os.environ[f'PYSIDEMATERIAL_{v.upper()}'] for v in self.colors} self.dock_theme = QUiLoader().load(os.path.join(os.path.dirname(__file__), 'dock_theme.ui'), parent) parent.addDockWidget(Qt.LeftDockWidgetArea, self.dock_theme) self.dock_theme.setFloating(True) self.update_buttons() self.dock_theme.checkBox_ligh_theme.clicked.connect(self.update_theme) for color in self.colors: button = getattr(self.dock_theme, f'pushButton_{color}') button.clicked.connect(self.set_color(parent, color))
def __init__(self, uifile, parent=None): super(Counter, self).__init__(parent) self.ui_file = QFile(uifile) self.ui_file.open(QFile.ReadOnly) self.loader = QUiLoader() self.window = self.loader.load(self.ui_file) self.ui_file.close() # определим компоненты управления self.select_company = self.window.findChild(QAction, 'select_company') self.select_counterparties = self.window.findChild( QAction, 'select_counterparties') self.journal_income_consumption = self.window.findChild( QAction, 'journal_income_consumption') self.select_service = self.window.findChild(QAction, 'select_service') # назначим действия для объектов self.select_company.triggered.connect(self.read_company) self.select_counterparties.triggered.connect(self.read_counterparties) self.select_service.triggered.connect(self.read_service) self.window.show()
def __init__(self, student=None, eventTitle=None): super().__init__() # Loading our ui file and giving it some data self.UI = QUiLoader().load( pathJoin('attendanceTracker', 'assets', 'studentWidget.ui')) # Collecting variables from constructor self.student = student self.eventTitle = eventTitle # Setting initial values of our widget self.setWidgetInformation() # Setting some flags to make the window work self.editMode = False self.toggleEditable(False) # Binding some buttons self.UI.editButton.pressed.connect(self.toggleEditable) self.UI.clearButton.pressed.connect(self._clearInfo) self.UI.studentCheckinButton.pressed.connect(self.studentCheckin)
def __init__(self, dataPoints=[], blankDataLen=0, parent=None): super(exergyAnalysisWindow,self).__init__(parent) ui_file = QFile('exergyAnalysis/exergyAnalysis.ui') ui_file.open(QFile.ReadOnly) loader = QUiLoader() self.window = loader.load(ui_file) # self.window is ui self.tagNameDict=defaultdict(list) self.dataPoints = dataPoints # list of all entered data in form of ditionary self.tagName=["Process Parameters","Biomass Composition","Biochar Composition", "Bio-Oil Composition","Flue-gas Composition","Flue gas property Composition"] self.noOfAddedData = len(self.dataPoints)#0 # no of added data, 1 for 1 data self.sendData=defaultdict(list) self.receivedData=defaultdict(list) self.createwidgets() self.createTagNameDict() self.updateDataPointsFromProcessParameters(blankLength = blankDataLen) ui_file.close()
def __init__(self, ui_file): super().__init__() # Open ui file ui_file = QFile(ui_file) ui_file.open(QFile.ReadOnly) # Load the ui loader = QUiLoader() ui_interface = loader.load(ui_file, self) ui_file.close() # Assign the ui controls to some refrences for easy access self.button = ui_interface.button self.label = ui_interface.label # pylint: disable=E1101 self.button.clicked.connect(self.update) self.label.setText('') self.count = 0
def __init__(self): self.qt_app = QApplication() self.settings = self.load_settings() self.db_conn = DatabaseConnection(self) # ===== Input fields ===== loader = QUiLoader() self.main_window = loader.load("dbtools.ui") self.schema_input = self.main_window.findChild(QLineEdit, "schema") self.table_input = self.main_window.findChild(QLineEdit, "table") self.max_values_input = self.main_window.findChild(QLineEdit, "max_values") self.time_min_input = self.main_window.findChild(QDateTimeEdit, "time_min") self.time_max_input = self.main_window.findChild(QDateTimeEdit, "time_max") self.retrieve_by_input = self.main_window.findChild(QComboBox, "retrieve_by") # ===== Buttons ===== self.start_up_button = self.main_window.findChild(QPushButton, "start_up") self.start_up_button.clicked.connect(self.start_postgres_daemon) self.shut_down_button = self.main_window.findChild(QPushButton, "shut_down") self.shut_down_button.clicked.connect(self.shut_down_postgres_daemon) self.connect_button = self.main_window.findChild(QPushButton, "connect") self.connect_button.clicked.connect(self.connect_to_database) self.visualize_button = self.main_window.findChild(QPushButton, "graph") self.visualize_button.clicked.connect(self.create_graph) self.export_button = self.main_window.findChild(QPushButton, "export_2") self.export_button.clicked.connect(self.export_as_csv) self.backup_button = self.main_window.findChild(QPushButton, "backup") self.backup_button.clicked.connect(self.backup_database) self.restore_button = self.main_window.findChild(QPushButton, "restore") self.restore_button.clicked.connect(self.restore_to_backup) self.main_window.show() self.qt_app.exec_()
def __init__(self, ui_file, application, parent=None): #creating Gui super(Form, self).__init__(parent) # open UI ui_file = QFile(ui_file) ui_file.open(QFile.ReadOnly) # loading GUI loader = QUiLoader() self.window = loader.load(ui_file) ui_file.close() # console displaying things self.radiationStatus = self.window.findChild(QLabel, 'radiationStatus') self.gpsStatus = self.window.findChild(QLabel, 'gpsStatus') self.generateStatus = self.window.findChild(QLabel, 'generateStatus') self.gpsDateStatus = self.window.findChild(QLabel, 'GPSDate') self.radiationDateStatus = self.window.findChild( QLabel, 'radiationDate') self.intersectionDateStatus = self.window.findChild( QLabel, 'intersectionDate') self.timeZone = self.window.findChild(QLineEdit, 'timeZone') # button action btn = self.window.findChild(QPushButton, 'radiationData') btn.clicked.connect(self.radiationData) btn = self.window.findChild(QPushButton, 'gpsData') btn.clicked.connect(self.gpsData) btn = self.window.findChild(QPushButton, 'generate') btn.clicked.connect(self.generate) self.generatedData = None self.gpsDataList = None self.radiationDataList = None self.window.show()
def __init__(self, ui_file, parent=None): super(LoggingWindow, self).__init__(parent) ui_file = QFile(ui_file) ui_file.open(QFile.ReadOnly) loader = QUiLoader() self.logging_window = loader.load(ui_file) ui_file.close() self.setting_path = '' self.user_file_path = os.getcwd() + '/users/users_settings.csv' self.btn_login: QPushButton = self.logging_window.findChild( QPushButton, 'btn_login') self.btn_settings_name_edit: QPushButton = self.logging_window.findChild( QPushButton, 'btn_settings_name_edit') btn_statistics: QPushButton = self.logging_window.findChild( QPushButton, 'btn_statistics') btn_statistics.clicked.connect(lambda: print('a')) self.slider_time: QSlider = self.logging_window.findChild( QSlider, 'slider_time') self.le_username = self.logging_window.findChild( QLineEdit, 'le_username') self.le_game_time: QLineEdit = self.logging_window.findChild( QLineEdit, 'le_game_time') self.lb_settings_name: QLabel = self.logging_window.findChild( QLabel, 'lb_settings_name') self.lb_login_status: QLabel = self.logging_window.findChild( QLabel, 'lb_login_status') self.test: QLabel = self.logging_window.findChild(QLabel, 'test') self.slider_time.sliderMoved.connect(lambda pos: self.set_time(pos)) self.le_game_time.editingFinished.connect(self.set_slider_position) self.le_username.editingFinished.connect(self.check_user) self.btn_settings_name_edit.clicked.connect(self.reload_settings) self.btn_login.clicked.connect(lambda: self.close()) self.logging_window.setWindowTitle('{} Login'.format( GlobalParams.application_name)) self.logging_window.show()
def __init__(self, detector_module, image_miner_module, parent=None): QWidget.__init__(self, parent) base_dir = os.path.dirname(os.path.realpath(__file__)) form_dir = os.path.join(base_dir, 'forms', 'aruco_tester_widget.ui') file = QFile(form_dir) file.open(QFile.ReadOnly) loader = QUiLoader() self.widget = loader.load(file, self) file.close() self.targetAngle = 0 # connect signals self.widget.pbRecord.clicked.connect(self.onRecordClicked) self.widget.pbSaveToFile.clicked.connect(self.onSaveToFileClicked) board = boards[self.use_board] config_dir = os.path.join(base_dir, '..', 'config', 'config.yaml') self.aruco_detector = detector_module( load(open(config_dir), Loader=Loader)) self.image_miner_module = image_miner_module self.aruco_detector.set_image_miner(self.image_miner_module) self.aruco_detector.launch_detection_workers() self.broadcaster = Broadcaster(self) self.aruco_detector.launch_analyzer(self.broadcaster) self.broadcaster.updateX.connect(self.widget.leX.setText) self.broadcaster.updateY.connect(self.widget.leY.setText) self.broadcaster.updateZ.connect(self.widget.leZ.setText) self.broadcaster.updateYaw.connect(self.widget.leYaw.setText) self.broadcaster.updatePitch.connect(self.widget.lePitch.setText) self.broadcaster.updateRoll.connect(self.widget.leRoll.setText) self.broadcaster.updateTimestamp.connect( self.widget.leTimestamp.setText) self.broadcaster.recordingStopped.connect(self.enableRecordButton)
def __init__(self): ui_file_name = "gui.ui" ui_file = QFile(ui_file_name) if not ui_file.open(QIODevice.ReadOnly): print("Cannot open {}: {}".format(ui_file_name, ui_file.errorString())) sys.exit(-1) loader = QUiLoader() self.window = loader.load(ui_file) ui_file.close() if not self.window: print(loader.errorString()) sys.exit(-1) self.window.show() self.turn = 0 self.board = np.array([[0, 0, 0], [0, 0, 0], [0, 0, 0]]) #buttons self.window.ox_1.clicked.connect( lambda: self.turns('1')) #tu musi byc lambda self.window.ox_2.clicked.connect(lambda: self.turns('2')) self.window.ox_3.clicked.connect(lambda: self.turns('3')) self.window.ox_4.clicked.connect(lambda: self.turns('4')) self.window.ox_5.clicked.connect(lambda: self.turns('5')) self.window.ox_6.clicked.connect(lambda: self.turns('6')) self.window.ox_7.clicked.connect(lambda: self.turns('7')) self.window.ox_8.clicked.connect(lambda: self.turns('8')) self.window.ox_9.clicked.connect(lambda: self.turns('9')) #reset self.window.pbReset.clicked.connect(lambda: self.reset()) #set winner labels self.window.player1_points.setText("0") self.window.player2_points.setText("0") self.player_1_points = 0 self.player_2_points = 0
def __init__(self, ui_file, parent=None): super(Application, self).__init__(parent) ui_file = QFile(ui_file) ui_file.open(QFile.ReadOnly) loader = QUiLoader() self.window = loader.load(ui_file) self.jtag = False # OpenOCD connection is running? atexit.register(self.kill_openocd) # Kill OpenOCD at exit self.window.make.clicked.connect(lambda x: self.make("")) self.window.clean.clicked.connect(lambda x: self.make("clean")) self.window.flash.clicked.connect(lambda x: self.make("flash")) self.window.debug.clicked.connect(self.debug) self.window.project.clicked.connect(self.select_project) self.selected_project = BASE_DIR + DEFAULT_PROJ self.output_text_line = 1 self.window.show()
def __init__(self): super().__init__() self.pwd = os.path.abspath('.') self.ui = QUiLoader().load(self.pwd + '.\\Ui\\searchNameWin.ui') self.setWidget(self.ui) self.setWindowTitle("模糊查找") self.windowType = 'SearchNameWin' # 按键绑定 self.ui.buttonSearch.clicked.connect(self.ButtonSearchClicked) self.ui.buttonChooseDir.clicked.connect(self.ButtonChooseDirClicked) # self.ui.tableMyFile.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) # 右键菜单初始化 self.RightClickMenuInit() # 参数初始化 self.fileSearchName = '' self.directory = '' self.dirQueue = Queue() self.qLock = threading.Lock()
def load_ui(self): loader = QUiLoader() path = os.path.join(os.path.dirname(__file__), "loadProjectsWindow.ui") ui_file = QFile(path) ui_file.open(QFile.ReadOnly) self.window = loader.load(ui_file, self) self.statusbar = self.window.findChild(QStatusBar, 'statusbar') self.listWidget = self.window.findChild(QListWidget, 'listWidget') self.listWidget.clicked.connect(self.ItemClicked) pushButtonLoadProject = self.window.findChild(QPushButton, 'pushButtonLoadProject') pushButtonLoadProject.clicked.connect(self.LoadSelectedProjectFile) # newitem = QListWidgetItem("thing 1") # self.listWidget.addItem(newitem) self.GetProjects() self.window.show() ui_file.close()
def __init__(self, parent=None, address=None, port=None, use_audio=False, rtsp_port=None): super(PiScanClient, self).__init__(parent) common.setInstance(self) ui_file = 'scan_client.ui' ui_file = QFile(ui_file) ui_file.open(QFile.ReadOnly) loader = QUiLoader() self.window = loader.load(ui_file) ui_file.close() self.parentWindow = parent #layout = QGridLayout(self) #layout.setContentsMargins(0, 0, 0, 0) #layout.addWidget(self.window) self.dataReceived.connect(self.handleReceived) self.connectDialog = connect.ConnectDialog(self.window, address, port) self.scanner = scanner.Scanner(self.window) self.dialogs = dialogs.Dialogs(self.window) self.contextStack = self.window.findChild(QStackedWidget, 'contextStack') #self.setWindowMode(common.WindowMode.CONNECT) self.showConnectDialog() #self.setWindowMode(common.WindowMode.SCANNER) #self.window.show() self.inmsg = messages_pb2.ServerToClient() self.use_audio = use_audio self.audio = audio_manager.AudioManager()
def __init__(self, app, docName, pMatch, numMatch, matchNames, matchPercent, graph): self.app = app ui_file = QFile("frontend/gui/doc_obj.ui") ui_file.open(QFile.ReadOnly) loader = QUiLoader() self.widget = loader.load(ui_file, self.app).findChild(QWidget, "docObject") ui_file.close() self.documentName = docName self.percentMatch = pMatch self.matchCount = numMatch self.matchList = matchNames self.matchPercentAndFP = matchPercent self.graph = graph self.create_widget()
def __init__(self, ui_file = 'MainWindow.ui', parent=None): #call class parent (QObject) constructor super(MainWindow, self).__init__(parent) #load the UI file into Python #ui_file was a string, now it's a proper QT object ui_file = QFile(ui_file) ui_file.open(QFile.ReadOnly) loader = QUiLoader() self.window = loader.load(ui_file) self.window.setWindowFlags(Qt.Window | Qt.FramelessWindowHint) #always remember to close files ui_file.close() #add event listeners for UI events self.addEventListeners() #show window to the user self.window.show()
def __init__(self, allSettings): self.app = QtWidgets.QApplication(sys.argv) self.app.setStyle('fusion') self.allSettings = allSettings ui_file = QFile('micronux/micronux.ui') ui_file.open(QFile.ReadOnly) loader = QUiLoader() self.win = loader.load(ui_file) ui_file.close() self.win.setWindowTitle('Micronux') self.win.setWindowIcon(QIcon('micronux/icon.png')) self.lcdV = self.win.display_setting_value self.lcdU = self.win.display_setting_unit self.lcdN = self.win.display_setting_name self.button_groups = df.get_button_groups(self.win) self.loaded = False
class UILoader: """ Provides a simple wrapper around Qt's .ui file loader, which takes the name of a ui file and loads it. """ path = pathlib.Path(os.path.dirname(__file__)) loader = QUiLoader() @classmethod def load(cls, form: str) -> QWidget: """ Load up a .ui file and return it. :param form: The name of the .ui file to load, without the .ui extension :return: The QWidget created from the UI file """ ui_path = str(cls.path / f"forms/designer/{form}.ui") ui_file = QFile(ui_path) ui_file.open(QFile.ReadOnly) return cls.loader.load(ui_file)
def __init__(self, parent=None): QWidget.__init__(self, parent) base_dir = os.path.dirname(os.path.realpath(__file__)) dir = os.path.join(base_dir, 'forms', 'acs_control_widget.ui') file = QFile(dir) file.open(QFile.ReadOnly) loader = QUiLoader() self.widget = loader.load(file, self) file.close() self.controller = ACSController() self.widget.pbOpen.clicked.connect(self.onOpenPortClicked) self.widget.pbMotorOn.clicked.connect(self.onMotorOnClicked) self.widget.pbMotorOff.clicked.connect(self.onMotorOffClicked) self.widget.pbStopMotor.clicked.connect(self.onMotorStopClicked) self.widget.pbPA.clicked.connect(self.onSetTargetAngleClicked) self.widget.pbSP.clicked.connect(self.onSetSpeedClicked) self.widget.leFeedback.setText('DISPLAY OF FEEDBACK INFO') self.widget.lePort.setText('/dev/ttyUSB0')
def setupUi(self, Form): path = f"{os.path.dirname(__file__)}/new_gui.ui" ui_file = QFile(path) ui_file.open(QFile.ReadOnly) loader = QUiLoader() self._window = loader.load(ui_file) # Set courses_tab stylesheet so that delegates can inherit it self._window.courses_tab.setStyleSheet(self._window.styleSheet()) # Need to fix this courses list view self._window.coursesView = CoursesListView(self._window.courses_tab) self._window.courses_layout.addWidget(self._window.coursesView) self._window.coursesView.setObjectName("coursesView") self._window.coursesView2.deleteLater() self.icon = QIcon(":/root/imgs/icons/polibeepsync.svg") self.retranslateUi(self._window) self._window.tabWidget.setCurrentIndex(0) QMetaObject.connectSlotsByName(self._window)
def __init__(self): self.ui = QUiLoader().load('Main.ui') self.indir_src = r'src' + '\\' self.indir_data = r'data' + '\\' self.src_dir_num = len(os.listdir('src')) self.files = os.listdir(self.indir_src) # 返回指定文件夹的列表名 self.files.sort(key=lambda x:int(x)) for src_Names in self.files: self.ui.textEdit.append(src_Names) if os.path.exists('config.txt'): with open('config.txt', 'r', encoding='utf-8') as f: self.ui.lineEdit_4.setText(f.readline().strip()) self.ui.lineEdit_5.setText(f.readline().strip()) self.A_Pid = QtCharts.QPieSeries() self.A_Pid1 = QtCharts.QPieSeries() self.All_Pid = QtCharts.QPieSeries() self.All_Pid1 = QtCharts.QPieSeries() self.Bar = QtCharts.QBarSeries() self.QX = QtCharts.QBarCategoryAxis() self.QY = QtCharts.QValueAxis() self.Chart_P = QtCharts.QChart() self.Chart_B = QtCharts.QChart() self.ui.pushButton.clicked.connect(self.A_News) self.ui.pushButton_2.clicked.connect(self.All_News) self.ui.pushButton_3.clicked.connect(self.News_search) self.ui.pushButton_4.clicked.connect(self.Get_V) self.ui.pushButton_5.clicked.connect(self.Train_test) self.ui.pushButton_6.clicked.connect(self.Save_Apid) self.ui.pushButton_7.clicked.connect(self.Show_APid) self.ui.pushButton_15.clicked.connect(self.Show_AllPid) self.ui.pushButton_16.clicked.connect(self.Show_Bar)
def __init__(self, ui_file, parent=None): #call parent QObject constructor super(MainWindow, self).__init__(parent) #load the UI file into Python ui_file = QFile(ui_file) ui_file.open(QFile.ReadOnly) loader = QUiLoader() self.window = loader.load(ui_file) #always remember to close files ui_file.close() login_button = self.window.findChild(QPushButton, 'loginButton') login_button.clicked.connect(self.login_clicked) cancel_button = self.window.findChild(QPushButton, 'cancelButton') cancel_button.clicked.connect(self.cancel_clicked) #show should be last self.window.show()