def __init__(self, persepolis_setting): super().__init__() self.persepolis_setting = persepolis_setting icons = ':/' + str(persepolis_setting.value('settings/icons')) + '/' # window self.setMinimumSize(QtCore.QSize(595, 284)) self.setWindowIcon( QIcon.fromTheme('persepolis', QIcon(':/persepolis.svg'))) self.setWindowTitle("Persepolis Download Manager") verticalLayout = QVBoxLayout(self) # progress_tabWidget self.progress_tabWidget = QTabWidget(self) # information_tab self.information_tab = QWidget() information_verticalLayout = QVBoxLayout(self.information_tab) # link_label self.link_label = QLabel(self.information_tab) information_verticalLayout.addWidget(self.link_label) # status_label self.status_label = QLabel(self.information_tab) information_verticalLayout.addWidget(self.status_label) # downloaded_label self.downloaded_label = QLabel(self.information_tab) information_verticalLayout.addWidget(self.downloaded_label) # rate_label self.rate_label = QLabel(self.information_tab) information_verticalLayout.addWidget(self.rate_label) # time_label self.time_label = QLabel(self.information_tab) information_verticalLayout.addWidget(self.time_label) # connections_label self.connections_label = QLabel(self.information_tab) information_verticalLayout.addWidget(self.connections_label) # add information_tab to progress_tabWidget self.progress_tabWidget.addTab(self.information_tab, "") # options_tab self.options_tab = QWidget() options_tab_horizontalLayout = QHBoxLayout(self.options_tab) options_tab_horizontalLayout.setContentsMargins(11, 11, 11, 11) # limit_checkBox self.limit_checkBox = QCheckBox(self.options_tab) limit_verticalLayout = QVBoxLayout() limit_verticalLayout.addWidget(self.limit_checkBox) # limit_frame self.limit_frame = QFrame(self.options_tab) self.limit_frame.setFrameShape(QtWidgets.QFrame.StyledPanel) self.limit_frame.setFrameShadow(QtWidgets.QFrame.Raised) limit_frame_verticalLayout = QVBoxLayout(self.limit_frame) limit_frame_horizontalLayout = QHBoxLayout() # limit_spinBox self.limit_spinBox = QDoubleSpinBox(self.options_tab) self.limit_spinBox.setMinimum(1) self.limit_spinBox.setMaximum(1023) limit_frame_horizontalLayout.addWidget(self.limit_spinBox) # limit_comboBox self.limit_comboBox = QComboBox(self.options_tab) self.limit_comboBox.addItem("") self.limit_comboBox.addItem("") limit_frame_horizontalLayout.addWidget(self.limit_comboBox) # limit_pushButton self.limit_pushButton = QPushButton(self.options_tab) limit_frame_verticalLayout.addLayout(limit_frame_horizontalLayout) limit_frame_verticalLayout.addWidget(self.limit_pushButton) limit_verticalLayout.addWidget(self.limit_frame) limit_verticalLayout.setContentsMargins(11, 11, 11, 11) options_tab_horizontalLayout.addLayout(limit_verticalLayout) # after_checkBox self.after_checkBox = QCheckBox(self.options_tab) after_verticalLayout = QVBoxLayout() after_verticalLayout.addWidget(self.after_checkBox) # after_frame self.after_frame = QFrame(self.options_tab) self.after_frame.setFrameShape(QtWidgets.QFrame.StyledPanel) self.after_frame.setFrameShadow(QtWidgets.QFrame.Raised) after_frame_verticalLayout = QVBoxLayout(self.after_frame) # after_comboBox self.after_comboBox = QComboBox(self.options_tab) self.after_comboBox.addItem("") after_frame_verticalLayout.addWidget(self.after_comboBox) # after_pushButton self.after_pushButton = QPushButton(self.options_tab) after_frame_verticalLayout.addWidget(self.after_pushButton) after_verticalLayout.addWidget(self.after_frame) after_verticalLayout.setContentsMargins(11, 11, 11, 11) options_tab_horizontalLayout.addLayout(after_verticalLayout) self.progress_tabWidget.addTab(self.options_tab, "") verticalLayout.addWidget(self.progress_tabWidget) # download_progressBar self.download_progressBar = QProgressBar(self) verticalLayout.addWidget(self.download_progressBar) # buttons button_horizontalLayout = QHBoxLayout() button_horizontalLayout.addStretch(1) # resume_pushButton self.resume_pushButton = QPushButton(self) self.resume_pushButton.setIcon(QIcon(icons + 'play')) button_horizontalLayout.addWidget(self.resume_pushButton) # pause_pushButton self.pause_pushButton = QtWidgets.QPushButton(self) self.pause_pushButton.setIcon(QIcon(icons + 'pause')) button_horizontalLayout.addWidget(self.pause_pushButton) # stop_pushButton self.stop_pushButton = QtWidgets.QPushButton(self) self.stop_pushButton.setIcon(QIcon(icons + 'stop')) button_horizontalLayout.addWidget(self.stop_pushButton) verticalLayout.addLayout(button_horizontalLayout) self.progress_tabWidget.setCurrentIndex(0) # labels self.link_label.setText("Link :") self.status_label.setText("Status : ") self.downloaded_label.setText("Downloaded :") self.rate_label.setText("Transfer rate : ") self.time_label.setText("Estimate time left :") self.connections_label.setText("Number of connections : ") self.progress_tabWidget.setTabText( self.progress_tabWidget.indexOf(self.information_tab), "Download information") self.limit_checkBox.setText("Limit Speed") self.after_checkBox.setText("After download") self.limit_comboBox.setItemText(0, "KB/S") self.limit_comboBox.setItemText(1, "MB/S") self.limit_pushButton.setText("Apply") self.after_comboBox.setItemText(0, "Shut Down") self.progress_tabWidget.setTabText( self.progress_tabWidget.indexOf(self.options_tab), "Download Options") self.resume_pushButton.setText("Resume") self.pause_pushButton.setText("Pause") self.stop_pushButton.setText("Stop") self.after_pushButton.setText("Apply")
import sys import asyncio from PyQt5.QtWidgets import QApplication, QProgressBar, \ QMessageBox, QLineEdit from quamash import QEventLoop from .bot import Client logging.basicConfig(level=logging.INFO) app = QApplication(sys.argv) loop = QEventLoop(app) asyncio.set_event_loop(loop) progress = QProgressBar() progress.setRange(0, 100) progress.show() async def main(config): app.init_task = loop.create_task(init_screen()) bot = Client(loop=loop, command_prefix='demon ', ready_callback=ready) app.bot = bot @bot.command() async def ping(ctx): await ctx.send('hello') loop.create_task(bot.start(config.TOKEN))
def initUI(self): self.curdir = os.path.dirname(os.path.abspath(__file__)) self.setWindowIcon(QIcon(os.path.join(self.curdir, "Pictures", "icon.ico"))) title = QLabel('Проект:') self.titleEdit = QLabel('Проект не загружен') self.ligato = QLabel('') myPix = QPixmap(os.path.join(self.curdir, "Pictures", "ligato.png")) self.ligato.setPixmap(myPix) self.ligato.mousePressEvent = self.ligato_site self.btn_load = QPushButton('Загрузить проект', self) self.btn_load.clicked.connect(self.showDlgLoadExl) self.btn_vr = QPushButton('Объемы работ', self) self.btn_vr.setDisabled(True) self.btn_vr.clicked.connect(self.calcvr) self.btn_so1 = QPushButton('CO1', self) self.btn_so1.setDisabled(True) self.btn_so1.clicked.connect(self.makeso) self.btn_so2 = QPushButton('CO2', self) self.btn_so2.setDisabled(True) self.btn_so2.clicked.connect(self.makeso) self.btn_so3 = QPushButton('CO3', self) self.btn_so3.setDisabled(True) self.btn_so3.clicked.connect(self.makeso) self.btn_spec = QPushButton('Спецификация', self) self.btn_spec.setDisabled(True) self.btn_spec.clicked.connect(self.makes) self.list_det = QListWidget(self) self.btn_exit = QPushButton('Выход', self) self.btn_exit.clicked.connect(QApplication.closeAllWindows) self.btn_help = QPushButton('Справка', self) self.btn_help.clicked.connect(self.help) self.progress = QProgressBar(self) self.progress.setValue(0) grid = QGridLayout() grid.setSpacing(10) grid.addWidget(title, 1, 0) grid.addWidget(self.titleEdit, 1, 1, 1, 3) grid.addWidget(self.btn_load, 2, 0) grid.addWidget(self.list_det, 2, 2, 2, 2) grid.addWidget(self.btn_spec, 5, 1) grid.addWidget(self.btn_vr, 3, 0) grid.addWidget(self.btn_so1, 2, 1) grid.addWidget(self.btn_so2, 3, 1) grid.addWidget(self.btn_so3, 4, 1) grid.addWidget(self.btn_exit, 5, 0) grid.addWidget(self.btn_help, 4, 0) grid.addWidget(self.ligato, 4, 3, 2, 1) grid.addWidget(self.progress, 6, 0, 1, 4) self.setLayout(grid) self.setWindowTitle('Генератор объемов работ и спецификаций. версия %s' % VERSION) self.hw = HelpWindow() self.show()
def init_ui(self): # ================变量================ # self.export_type = 'Hexo' # self.display_comments = True # 是否在博文中显示历史评论 # self.GitHubPathStr = '你的GitHub主文件夹路径' # self.owner = '你的GitHub账号名' # self.repo_name = '你存放图片的GitHub库名称' # ================组件================ self.button = QPushButton('执行任务') self.button.setToolTip('点击此按钮') self.button.clicked.connect(self.onStartButton) self.label = QLabel('迁移到') self.rbtn1 = QRadioButton('Hexo') self.rbtn2 = QRadioButton('Hugo') self.rbtn3 = QRadioButton('Jekyll') self.rbtn4 = QRadioButton('Gridea') self.rbtn5 = QRadioButton('Wordpress') self.rbtn5.setChecked(True) self.cb1 = QCheckBox('在输出文件中包含评论', self) self.cb1.setChecked(True) # self.cb.stateChanged.connect(self.show_comments) self.cb2 = QCheckBox('强制转换图片网址到GitHub图床', self) self.label1 = QLabel('GitHub主文件夹') self.label2 = QLabel('GitHub账号名') self.label3 = QLabel('GitHub库名称') self.label4 = QLabel('当前文件夹') self.label5 = QLabel('读取自') self.label6 = QLabel('保存到文件夹') self.label7 = QLabel('调试信息') self.label8 = QLabel('调试日志') self.label9 = QLabel('进度') self.qle1 = QLineEdit(self) self.qle2 = QLineEdit(self) self.qle3 = QLineEdit(self) self.qle4 = QLineEdit(self) self.qle5 = QLineEdit(self) self.qle6 = QLineEdit(self) self.qle7 = QLineEdit(self) self.textEdit = QTextEdit() # self.qle7.setStyleSheet("QCustomLineEdit{color: gray;}") # self.qle4.setEnabled(False) # self.qle5.setEnabled(False) # self.qle6.setEnabled(False) # self.qle7.setEnabled(False) # self.textEdit.setEnabled(False) self.qle4.setReadOnly(True) self.qle5.setReadOnly(True) self.qle6.setReadOnly(True) self.qle7.setReadOnly(True) self.textEdit.setReadOnly(True) self.qle1.setPlaceholderText("你的GitHub主文件夹路径") self.qle2.setPlaceholderText("你的GitHub账号名") self.qle3.setPlaceholderText("你存放图片的GitHub库名称") self.qle4.setText(dirpath) self.pbar = QProgressBar(self) # ================状态栏================ self.statusBar().showMessage('准备就绪') # ================菜单栏================ helloAction = QAction('你好', self) helloAction.setShortcut('Ctrl+H') helloAction.setStatusTip('程序问候') helloAction.triggered.connect(self.onHello) # exitAction = QAction(QIcon('exit.png'), '&Exit', self) exitAction = QAction('退出', self) exitAction.setShortcut('Ctrl+Q') exitAction.setStatusTip('退出程序') exitAction.triggered.connect(qApp.quit) aboutAction = QAction('关于', self) aboutAction.setShortcut('Ctrl+A') aboutAction.setStatusTip('关于程序') aboutAction.triggered.connect(self.onAbout) # 创建一个菜单栏 menubar = self.menuBar() # 添加菜单 fileMenu = menubar.addMenu('文件') otherMenu = menubar.addMenu('其他') # 添加事件 fileMenu.addAction(helloAction) fileMenu.addAction(exitAction) otherMenu.addAction(aboutAction) # ================工具栏================ self.toolbar = self.addToolBar('工具') self.toolbar.addAction(exitAction) self.toolbar.addAction(helloAction) self.toolbar.addAction(aboutAction) # ================多选框组================ self.btngroup = QButtonGroup() self.btngroup.setExclusive(True) self.btngroup.addButton(self.rbtn1) self.btngroup.addButton(self.rbtn2) self.btngroup.addButton(self.rbtn3) self.btngroup.addButton(self.rbtn4) self.btngroup.addButton(self.rbtn5) self.btngroup.buttonClicked.connect(self.on_click) # ================绑定================ # ================布局================ rbtnlayout = QHBoxLayout() rbtnlayout.addWidget(self.label) rbtnlayout.addWidget(self.rbtn1) rbtnlayout.addWidget(self.rbtn2) rbtnlayout.addWidget(self.rbtn3) rbtnlayout.addWidget(self.rbtn4) rbtnlayout.addWidget(self.rbtn5) rbtnlayout.addStretch(1) buttonlayout = QHBoxLayout() # buttonlayout.addStretch(1) buttonlayout.addWidget(self.button) buttonlayout.addStretch(1) grid = QGridLayout() grid.setSpacing(10) grid.addWidget(self.label1, 1, 0) grid.addWidget(self.qle1, 1, 1) grid.addWidget(self.label2, 2, 0) grid.addWidget(self.qle2, 2, 1) grid.addWidget(self.label3, 3, 0) grid.addWidget(self.qle3, 3, 1) grid.addWidget(self.label4, 4, 0) grid.addWidget(self.qle4, 4, 1) grid.addWidget(self.label5, 5, 0) grid.addWidget(self.qle5, 5, 1) grid.addWidget(self.label6, 6, 0) grid.addWidget(self.qle6, 6, 1) grid.addWidget(self.label7, 7, 0) grid.addWidget(self.qle7, 7, 1) grid.addWidget(self.label8, 8, 0) # grid.addWidget(self.textEdit, 8, 1, 2, 1) grid.addWidget(self.textEdit, 8, 1) grid.addWidget(self.label9, 9, 0) grid.addWidget(self.pbar, 9, 1) # ================主布局================ vbox = QVBoxLayout() vbox.addLayout(buttonlayout) vbox.addWidget(self.cb1) vbox.addWidget(self.cb2) vbox.addLayout(rbtnlayout) # vbox.addWidget(self.label2) vbox.addLayout(grid) # vbox.addStretch(1) # ================窗口设置================ # self.setGeometry(200, 200, 300, 300) layout_widget = QWidget() # create QWidget object layout_widget.setLayout(vbox) # set layout self.setCentralWidget(layout_widget) # make QWidget the central widget self.setWindowTitle(app_name) # self.resize(250, 150) self.center() self.show()
def initUI(self): self.current_dir = os.path.abspath(__file__).replace('\\', '/') self.current_dir = get_folder_from_file(self.current_dir) self.current_dir += 'support_files/' self.blanck = cv2.imread(self.current_dir + 'blanck.jpg') self.blanck_simu = cv2.imread(self.current_dir + 'blanck_simu.jpg') self.img = self.blanck print(self.current_dir) # self.font = cv2.FONT_HERSHEY_SIMPLEX self.time_start = 0 self.time_usage = 50 self.canvas_blank = np.zeros((512, 512), dtype=np.int8) openAct = QAction(QIcon(self.current_dir + 'open.png'), '&Open', self) openAct.setShortcut('Ctrl+F') openAct.triggered.connect(self.open_file) exitAct = QAction(QIcon(self.current_dir + 'quit.png'), '&Quit', self) exitAct.setShortcut('Ctrl+Q') exitAct.triggered.connect(qApp.quit) help_contact = QAction(QIcon(self.current_dir + 'email.png'), 'Contact', self) help_contact.triggered.connect(self.contact) help_about = QAction('About', self) help_about.triggered.connect(self.about) self.menubar = self.menuBar() FileMenu = self.menubar.addMenu('&File') FileMenu.addAction(openAct) FileMenu.addAction(exitAct) HelpMenu = self.menubar.addMenu('&Help') HelpMenu.addAction(help_contact) HelpMenu.addAction(help_about) self.open_button = QToolButton() self.open_button.setIcon(QIcon(self.current_dir + 'galery.png')) self.open_button.setToolTip('Open File Ctr+F') self.open_button.clicked.connect(self.open_file) self.open_button.setShortcut('Ctr+F') self.run_button = QToolButton() self.run_button.setIcon(QIcon(self.current_dir + 'run.png')) self.run_button.setToolTip('Run F5') # self.run_button.clicked.connect(self.run_cut) self.run_button.setShortcut('F5') self.toolbar1 = self.addToolBar('Read') self.toolbar1.addWidget(self.open_button) self.pixmap = QPixmap() self.lbl_main = Label('', self) self.lbl_main.new_img.connect(self.refresh_img) # self.lbl_main.setAlignment(Qt.AlignTop) # self.lbl_main.setAlignment(Qt.AlignCenter) self.lbl_main.setPixmap(self.pixmap) self.img_qi = QImage(self.blanck[:], self.blanck.shape[1], self.blanck.shape[0],\ self.blanck.shape[1] * 3, QImage.Format_RGB888) self.pixmap = QPixmap(self.img_qi) self.lbl_main.setPixmap(self.pixmap) img_qi = QImage(self.blanck_simu[:], self.blanck_simu.shape[1], self.blanck_simu.shape[0],\ self.blanck_simu.shape[1] * 3, QImage.Format_RGB888) pixmap = QPixmap(img_qi) self.lbl_simu = QLabel(self) self.lbl_simu.setPixmap(pixmap) self.lbl_L1 = QLabel('L_1', self) self.text_L1 = QLineEdit('1', self) self.lbl_L1_ly = QLabel('light year(s)', self) self.lbl_L2 = QLabel('L_2', self) self.text_L2 = QLineEdit('1', self) self.lbl_L2_ly = QLabel('light year(s)', self) self.lbl_mass = QLabel('M', self) self.text_mass = QLineEdit('1e11', self) self.lbl_msun = QLabel('M_sun', self) self.lbl_height = QLabel('height', self) self.text_height = QLineEdit('1', self) self.lbl_height_ly = QLabel('light year(s)', self) self.start_button = QPushButton('Start Simulation', self) self.start_button.clicked.connect(self.start_simulation) self.pbar = QProgressBar(self) self.step = 0 self.progress_timer = QTimer() self.progress_timer.timeout.connect(self.step_pbar) # self.stop_button = QPushButton('Stop', self) # self.stop_button.clicked.connect(self.stop_simulation) self.panel = QGridLayout() self.panel.addWidget(self.lbl_L1, 0, 0) self.panel.addWidget(self.text_L1, 0, 1) self.panel.addWidget(self.lbl_L1_ly, 0, 2) self.panel.addWidget(self.lbl_L2, 1, 0) self.panel.addWidget(self.text_L2, 1, 1) self.panel.addWidget(self.lbl_L2_ly, 1, 2) self.panel.addWidget(self.lbl_mass, 2, 0) self.panel.addWidget(self.text_mass, 2, 1) self.panel.addWidget(self.lbl_msun, 2, 2) self.panel.addWidget(self.lbl_height, 3, 0) self.panel.addWidget(self.text_height, 3, 1) self.panel.addWidget(self.lbl_height_ly, 3, 2) self.panel.addWidget(self.start_button, 4, 1) self.panel.addWidget(self.pbar, 5, 1) self.vbox = QVBoxLayout() self.vbox.addStretch(0) self.vbox.addLayout(self.panel) self.vbox.addStretch(0) self.hbox = QHBoxLayout() self.hbox.addWidget(self.lbl_main) self.hbox.addWidget(self.lbl_simu) self.hbox.addLayout(self.vbox, Qt.AlignRight) self.central_widget = QWidget() self.central_widget.setMouseTracking(True) self.layout = QVBoxLayout(self.central_widget) self.setCentralWidget(self.central_widget) self.layout.addLayout(self.hbox) desktop = QDesktopWidget() self.screen_width = desktop.screenGeometry().width() self.screen_height = desktop.screenGeometry().height() self.img_width = int((self.screen_width - 500) / 2) self.img_height = int(self.screen_height - 100) print(self.screen_height, self.screen_width) self.setWindowIcon(QIcon(self.current_dir + 'lensing.png')) self.setWindowTitle('Gravitational Lens Simulation') self.show()
if __name__ == "__main__": app = QApplication(sys.argv) app.setStyle('Fusion') # app.setWindowIcon(QIcon(os.path.join(bundle_dir, 'logo.png'))) splash_pix = QPixmap(os.path.join(bundle_dir, 'loadingLogo.png')) splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint) # splash = MySplashScreen('chicken.gif', Qt.WindowStaysOnTopHint) splash.setWindowFlags(Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint | Qt.Tool) splash.setEnabled(False) # splash = QSplashScreen(splash_pix) # adding progress bar progressBar = QProgressBar(splash) # progressBar.setMaximum(10) progressBar.setGeometry(100, splash_pix.height() - 50, splash_pix.width() - 200, 20) # progressBar.setGeometry(150, 320, 200, 18) # splash.setMask(splash_pix.mask()) splash.show() splash.showMessage("Expanding app", Qt.AlignBottom | Qt.AlignCenter, Qt.black) app.processEvents() # initLoop = Qt.QEventLoop() # pool = Pool(processes=1) # pool.apply_async(longInitialization, [2], callback=lambda exitCode: initLoop.exit(exitCode))
def __init__(self, configFile): super(WSPRUI, self).__init__() #Things that we need to keep track of to update self.wsprDevice = WSPRInterfaceObject(configFile) self.bandCheckboxes = [] self.CurrentGPSStatus = QProgressBar(self) self.gpsTime = QLabel("00:00:00") self.gpsPosition = QLabel("0000") self.gpsPower = QLabel("0") self.outputFreq = QLabel(self.formatFrequency("0")) self.setFrequencyValueLable = QLineEdit(self.formatFrequency("0")) self.dialFrequency = QDial() self.gpsLocked = QLabel("GPS Signal Quality:") self.portConnectionIcon = QLabel() self.portConnectionIcon.setFixedSize(50, 50) self.portConnectionIcon.mousePressEvent = self.handleConnectionIconClick self.txtCallsign = QLineEdit() self.portConnectionLabel = QLabel(self.wsprDevice.config.notconnectedtext) self.rdoStartUpSignalGen = QRadioButton("Signal Generator") self.rdoStartUpWSPRBeacon = QRadioButton("WSPR Beacon") self.rdoStartUpIdle = QRadioButton("Idle") self.pauseAfterTransmission = QLineEdit("120") self.manualLocationSetting = QLineEdit("FN44") self.useManualLocation = QCheckBox() self.chkCurrentSignalGen = QCheckBox("Signal Generator") self.chkCurrentWSPRBeacon = QCheckBox("WSPR Beacon") self.valCurrentMode = QLabel("") self.transmitStatus = QLabel("") self.buttonReload = QPushButton("Reload") self.buttonReload.setFixedSize(100, 50) self.buttonReload.clicked.connect(self.handleReloadPush) self.buttonReload.setVisible(self.wsprDevice.config.debug) self.buttonSave = QPushButton("Save") self.buttonChangeCurrentMode = QPushButton("Start") self.debugSection = QGroupBox("Info") self.textArea = QPlainTextEdit() self.textArea.setMaximumBlockCount(self.wsprDevice.config.debugAreaMaximumBlockCount) self.textArea.setReadOnly(True) self.commandArray = [Command.CALLSIGN, Command.BANDS, Command.STARTUP_MODE, Command.CURRENT_MODE, Command.POWER, Command.GENERATOR_FREQUENCY] self.factorySettingsArray = [Command.FACTORY_FREQUENCY_REFERENCE_OSCILLATOR_FREQUENCY, Command.FACTORY_HARDWARE_REVISION, Command.FACTORY_HARDWARE_VERSION, Command.FACTORY_LOWPASS_FINTER_INSTALLED, Command.FACTORY_PRODUCT_NUMBER, Command.FACTORY_SOFTWARE_REVISION, Command.FACTORY_SOFTWARE_VERSION] #Create the UI self.initUI() #Threads self.createThreads()
def __init__(self, config, parent=None): super(yue, self).__init__(parent) layout = QGridLayout() #创建一个表格排列 self.fileName1 = '' ###############第一行 文件选择框 layout.addWidget(QLabel('报表文件', self), 0, 0) self.qtfile = QLineEdit('', self) self.qtfile.insert(config['sheet_day']['filename'] if 'filename' in config['sheet_day'].keys() else '') self.qbfile = QPushButton('选择文件', self) self.qbfile.clicked.connect(self.button_click) self.qbfile.setEnabled(True) layout.addWidget(self.qtfile, 0, 1, 1, 6) layout.addWidget(self.qbfile, 0, 7) ######################第二行################################################ layout.addWidget(QLabel('规则行', self), 1, 0) self.gzh = QLineEdit('', self) self.gzh.insert(config['sheet_day']['gzh']) self.gzh.setFixedWidth(40) layout.addWidget(QLabel('时间列', self), 1, 2) self.sjl = QLineEdit('', self) self.sjl.insert(config['sheet_day']['sjl']) self.sjl.setFixedWidth(40) layout.addWidget(QLabel('BMS厂家', self), 1, 4) jslist = ['共济', '中联', '栅格'] self.jsComboBox = QComboBox(self) #下拉菜单 for i in jslist: self.jsComboBox.addItem(i) self.jsComboBox.setCurrentIndex(int(config['sheet_day']['cj'])) layout.addWidget(QLabel('模式', self), 1, 6) jslist2 = ['0--寻找日期', '1--最后填充'] self.js2ComboBox = QComboBox(self) #下拉菜单 for i in jslist2: self.js2ComboBox.addItem(i) self.js2ComboBox.setCurrentIndex(int(config['sheet_day']['mode'])) layout.addWidget(self.gzh, 1, 1) layout.addWidget(self.sjl, 1, 3) layout.addWidget(self.jsComboBox, 1, 5) layout.addWidget(self.js2ComboBox, 1, 7) ######################第三行时间选择行############################# layout.addWidget(QLabel('起始时间', self), 2, 0) nowyear = time.strftime('%Y', time.localtime(time.time())) nowyue = time.strftime('%m', time.localtime(time.time())) yearlist = [] for i in range(5): yearlist.append(str(int(nowyear) - i)) self.st_nianComboBox = QComboBox(self) #下拉菜单 for i in yearlist: self.st_nianComboBox.addItem(i + '年') yuelist = range(1, 13) self.st_yueComboBox = QComboBox(self) #下拉菜单 for i in yuelist: self.st_yueComboBox.addItem(str(i) + '月') #self.yueComboBox.setCurrentIndex(int(config['sheet_day']['mode'])) self.st_nianComboBox.setCurrentIndex(yearlist.index(nowyear)) self.st_yueComboBox.setCurrentIndex(yuelist.index(int(nowyue))) #self.js2ComboBox.setCurrentIndex(int(config['sheet_day']['mode'])) # #############结束时间选择 # layout.addWidget(QLabel('结束时间', self), 2, 4) self.en_nianComboBox = QComboBox(self) #下拉菜单 for i in yearlist: self.en_nianComboBox.addItem(i + '年') self.en_yueComboBox = QComboBox(self) #下拉菜单 for i in yuelist: self.en_yueComboBox.addItem(str(i) + '月') #self.yueComboBox.setCurrentIndex(int(config['sheet_day']['mode'])) self.en_nianComboBox.setCurrentIndex(yearlist.index(nowyear)) self.en_yueComboBox.setCurrentIndex(yuelist.index(int(nowyue))) ###########查询按钮########### self.qtb1 = QPushButton('查询', self) self.qtb1.clicked.connect(self.work) layout.addWidget(self.st_nianComboBox, 2, 1) layout.addWidget(self.st_yueComboBox, 2, 2) layout.addWidget(self.en_nianComboBox, 2, 5) layout.addWidget(self.en_yueComboBox, 2, 6) layout.addWidget(self.qtb1, 2, 7) #######第四行进度条 layout.addWidget(QLabel('进度', self), 3, 0) self.pbar = QProgressBar(self) #self.pbar.setFixedWidth(560) layout.addWidget(self.pbar, 3, 1, 1, 6) self.setLayout(layout)
def __init__(self): super().__init__() self.dev = None self.progress_signal.connect(self._on_progress) self.complete_signal.connect(self._on_complete) self.error_signal.connect(self._on_error) lbl_warning = QLabel( "<font color='red'><b>Make sure jumploader is installed before you flash QMK</b></font>" ) lbl_warning.setWordWrap(True) btn_flash_qmk = QPushButton("Flash QMK...") btn_flash_qmk.clicked.connect(self.on_click_flash_qmk) lbl_help = QLabel( "After jumploader is installed, hold Backspace while plugging in the keyboard to start in bootloader mode." ) lbl_help.setWordWrap(True) btn_reboot_bl = QPushButton("Reboot to Bootloader") btn_reboot_bl.clicked.connect(self.on_click_reboot) btn_flash_jumploader = QPushButton("Flash Jumploader") btn_flash_jumploader.clicked.connect(self.on_click_flash_jumploader) btn_restore_stock = QPushButton("Revert to Stock Firmware") btn_restore_stock.clicked.connect(self.on_click_revert) self.progress = QProgressBar() self.progress.setRange(0, 100) self.progress_label = QLabel("Ready") self.combobox_devices = QComboBox() btn_refresh_devices = QToolButton() btn_refresh_devices.setToolButtonStyle(Qt.ToolButtonTextOnly) btn_refresh_devices.setText("Refresh") btn_refresh_devices.clicked.connect(self.on_click_refresh) devices_layout = QHBoxLayout() devices_layout.addWidget(self.combobox_devices) devices_layout.addWidget(btn_refresh_devices) layout_qmk = QVBoxLayout() layout_qmk.setAlignment(Qt.AlignTop) layout_qmk.addWidget(lbl_warning) layout_qmk.addWidget(btn_flash_qmk) layout_qmk.addWidget(lbl_help) layout_stock = QVBoxLayout() layout_stock.setAlignment(Qt.AlignTop) layout_stock.addWidget(btn_reboot_bl) layout_stock.addWidget(btn_flash_jumploader) layout_stock.addWidget(btn_restore_stock) layout_progress = QVBoxLayout() layout_progress.addWidget(self.progress_label) layout_progress.addWidget(self.progress) group_qmk = QGroupBox("QMK") group_qmk.setLayout(layout_qmk) group_stock = QGroupBox("Stock") group_stock.setLayout(layout_stock) group_progress = QGroupBox("") group_progress.setLayout(layout_progress) group_layout = QHBoxLayout() group_layout.addWidget(group_qmk) group_layout.addWidget(group_stock) layout = QVBoxLayout() layout.addLayout(devices_layout, stretch=0) layout.addLayout(group_layout, stretch=1) layout.addWidget(group_progress, stretch=0) self.setLayout(layout) self.lockable = [ btn_flash_qmk, btn_reboot_bl, btn_flash_jumploader, btn_restore_stock, self.combobox_devices, btn_refresh_devices ] self.on_click_refresh()
def initUI(self): self.setWindowTitle(self.title) self.setGeometry(self.left, self.top, self.width, self.height) self.vocalMax = 60 self.vocalMin = 50 self.move(100, 100) self.songfile = '../data/13_LeadVox.wav' self.m = PlotCanvas(self, width=5, height=4, songfile=self.songfile, vocalRange=[self.vocalMin, self.vocalMax]) self.m.move(0, 70) self.addToolBar(NavigationToolbar(self.m, self)) button = QPushButton('Change Plot', self) button.setToolTip('This s an example button') button.clicked.connect(self.m.plot) button.move(500, 20) button.resize(140, 20) button = QPushButton('Input', self) button.setToolTip('This s an example button') button.clicked.connect(self.getInteger) button.move(500, 40) button.resize(140, 20) button = QPushButton('Open File', self) button.setToolTip('This s an example button') button.clicked.connect(self.getSongName) button.move(500, 60) button.resize(140, 20) self.label = QLabel(self) self.label.move(500, 80) self.label.resize(140, 40) self.label.show() self.songNameLabel = QLabel(self) newfont = QFont("Times", 12, QFont.Normal) self.songNameLabel.setFont(newfont) self.songNameLabel.move(10, 35) self.songNameLabel.resize(500, 40) self.songNameLabel.setWordWrap(True) self.songNameLabel.setAlignment(Qt.AlignTop) self.songNameLabel.show() self.songScoreLabel = QLabel(self) newfont = QFont("Times", 16, QFont.Bold) self.songScoreLabel.setFont(newfont) self.songScoreLabel.move(500, 130) self.songScoreLabel.resize(140, 30) self.songScoreLabel.show() self.progressBar = QProgressBar(self) self.progressBar.setRange(0, 1) self.progressBar.move(self.width - 140, self.height - 20) self.progressBar.resize(140, 20) self.progressBar.show() self.show() self.updateLabel()
def initLayout(self): layout = QVBoxLayout(self) ## -- ROW 1 row = QHBoxLayout() self.budgetProjection_btn = QPushButton() self.budgetProjection_btn.setToolTip("Check Budget Projection...") row.addWidget(self.budgetProjection_btn) self.selectMN_btn = QPushButton("Select Masternodes...") row.addWidget(self.selectMN_btn) self.selectedMNlabel = QLabel( "<em>0 masternodes selected for voting</em") row.addWidget(self.selectedMNlabel) row.addStretch(1) self.statusLabel = QLabel("") self.statusLabel.setMinimumWidth(116) self.resetStatusLabel('<b style="color:red">Reload Proposals</b>') row.addWidget(self.statusLabel) row.addStretch(1) self.mnCountLabel = QLabel() row.addWidget(self.mnCountLabel) self.refreshProposals_btn = QPushButton() self.refreshProposals_btn.setToolTip("Refresh Proposal List") row.addWidget(self.refreshProposals_btn) self.toggleExpiring_btn = QPushButton("Hide Expiring") self.toggleExpiring_btn.setToolTip( "Hide expiring proposals (yellow background) from list") row.addWidget(self.toggleExpiring_btn) layout.addLayout(row) ## -- ROW 2 self.proposalBox = QTableWidget() self.proposalBox.setMinimumHeight(280) self.proposalBox.setSelectionMode(QAbstractItemView.MultiSelection) self.proposalBox.setSelectionBehavior(QAbstractItemView.SelectRows) self.proposalBox.setShowGrid(True) self.proposalBox.setColumnCount(8) self.proposalBox.setRowCount(0) self.proposalBox.horizontalHeader().setSectionResizeMode( 0, QHeaderView.Stretch) self.proposalBox.setSortingEnabled(True) #self.proposalBox.verticalHeader().hide self.setProposalBoxHeader() self.proposalBox.setColumnWidth(1, 50) self.proposalBox.setColumnWidth(2, 50) self.proposalBox.setColumnWidth(3, 100) self.proposalBox.setColumnWidth(4, 100) self.proposalBox.setColumnWidth(5, 150) self.proposalBox.setColumnWidth(6, 120) self.proposalBox.setColumnWidth(7, 50) layout.addWidget(self.proposalBox) ## -- ROW 3 row = QHBoxLayout() self.timeIconLabel = QLabel() self.timeIconLabel.setToolTip( "Check to add a randomized time offset (positive or negative) to enhance privacy" ) row.addWidget(self.timeIconLabel) self.randomDelayCheck = QCheckBox() self.randomDelayCheck.setToolTip( "Check to add a randomized time offset when voting (max +5/-5 hrs)" ) row.addWidget(self.randomDelayCheck) self.randomDelayNeg_edt = QSpinBox() self.randomDelayNeg_edt.setPrefix('- ') self.randomDelayNeg_edt.setSuffix(" secs") self.randomDelayNeg_edt.setToolTip( "Maximum random time (in seconds) subtracted from each vote timestamp" ) self.randomDelayNeg_edt.setFixedWidth(100) self.randomDelayNeg_edt.setMaximum(18000) self.randomDelayNeg_edt.setValue(0) row.addWidget(self.randomDelayNeg_edt) self.randomDelayPos_edt = QSpinBox() self.randomDelayPos_edt.setPrefix("+ ") self.randomDelayPos_edt.setSuffix(" secs") self.randomDelayPos_edt.setToolTip( "Maximum random time (in seconds) added to each vote timestamp") self.randomDelayPos_edt.setFixedWidth(100) self.randomDelayPos_edt.setMaximum(18000) self.randomDelayPos_edt.setValue(300) row.addWidget(self.randomDelayPos_edt) row.addStretch(1) self.loadingLine = QLabel( "<b style='color:red'>Vote Signatures.</b> Completed: ") self.loadingLinePercent = QProgressBar() self.loadingLinePercent.setMaximumWidth(200) self.loadingLinePercent.setMaximumHeight(10) self.loadingLinePercent.setRange(0, 100) row.addWidget(self.loadingLine) row.addWidget(self.loadingLinePercent) self.loadingLine.hide() self.loadingLinePercent.hide() row.addStretch(1) self.selectedPropLabel = QLabel("<em>0 proposals selected</em>") row.addWidget(self.selectedPropLabel) self.questionLabel = QLabel() message = "Refresh proposals.\n" message += "GREEN: proposal passing\n" message += "WHITE: missing votes in order to pass\n" message += "RED: proposal not passing\n" message += "YELLOW: proposal expiring (last payment block)\n" self.questionLabel.setToolTip(message) row.addWidget(self.questionLabel) layout.addLayout(row) ## -- ROW 4 row = QHBoxLayout() self.voteYes_btn = QPushButton("Vote YES") self.voteYes_btn.setToolTip("Vote YES on selected proposals") row.addWidget(self.voteYes_btn) self.voteAbstain_btn = QPushButton("Vote ABSTAIN") self.voteAbstain_btn.setToolTip( "Vote ABSTAIN on selected proposals [currently disabled]") row.addWidget(self.voteAbstain_btn) self.voteNo_btn = QPushButton("Vote NO") self.voteNo_btn.setToolTip("Vote NO on selected proposals") row.addWidget(self.voteNo_btn) layout.addLayout(row)
def _status_bar_add_progress_bar(self, stretch=0): widget = QProgressBar() self._layout_add_widget(self._status_bar_layout, widget, stretch) return _QtWidget(widget)
async def downloadObject(self, ipfsop, objConfig): pBar = QProgressBar() def onProgressValue(val): if val in range(0, 50): pBar.setStyleSheet(''' QProgressBar:horizontal { border: 1px solid gray; border-radius: 5px; text-align: center; } QProgressBar::chunk:horizontal { text-align: center; background-color: #60cccf; } ''') else: pBar.setStyleSheet(''' QProgressBar:horizontal { border: 1px solid gray; border-radius: 5px; text-align: center; } QProgressBar::chunk:horizontal { text-align: center; background-color: #4b9fa2; } ''') pBar.setObjectName('downloadProgressBar') pBar.valueChanged.connect(onProgressValue) self.treeWidget().setItemWidget(self, self.COL_STATUS, pBar) baseDir = self.baseDownloadDir() chunkSize = objConfig.downloadChunkSize log.debug(f'Downloading with chunk size {chunkSize}') try: async for result in ipfsop.client.core.getgen( self.objdescr['path'], dstdir=str(baseDir), chunk_size=chunkSize, sleept=0.1): status, read, clength = result if status == 0: progress = (read * 100) / clength pBar.setValue(progress) elif status == 1: break await ipfsop.sleep(0.1) except aioipfs.APIError as e: # OK these setItemWidget() calls have got to go, this # is not middle age here. Replace by signals asap. self.treeWidget().setItemWidget(self, self.COL_STATUS, None) self.status(f'IPFS error: {e.message}') except Exception: self.treeWidget().setItemWidget(self, self.COL_STATUS, None) self.status('Error') else: pBar.setValue(100) self.status('Downloaded') self.treeWidget().setItemWidget(self, self.COL_STATUS, None) hDir = baseDir.joinpath(self.stat['Hash']) if self.objdescr['name']: nDir = baseDir.joinpath(self.objdescr['name']) else: nDir = hDir if nDir.exists(): return nDir if hDir.exists(): hDir.replace(nDir) return nDir
def setupGui(self): self.ui = uic.loadUi(os.path.join(GUIDIR, "labeltool.ui"), self) # get inserters and items from labels # FIXME for handling the new-style config correctly inserters = dict([(label['attributes']['class'], label['inserter']) for label in config.LABELS if 'class' in label.get('attributes', {}) and 'inserter' in label]) items = dict([(label['attributes']['class'], label['item']) for label in config.LABELS if 'class' in label.get('attributes', {}) and 'item' in label]) # Property Editor self.property_editor = PropertyEditor(config.LABELS) self.ui.dockProperties.setWidget(self.property_editor) # Scene self.scene = AnnotationScene(self.labeltool, items=items, inserters=inserters) self.property_editor.insertionModeStarted.connect(self.scene.onInsertionModeStarted) self.property_editor.insertionModeEnded.connect(self.scene.onInsertionModeEnded) # SceneView self.view = GraphicsView(self) self.view.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding) self.view.setScene(self.scene) self.central_widget = QWidget() self.central_layout = QVBoxLayout() self.controls = ControlButtonWidget() #give functions as lambdas, or else they will be called with a bool as parameter self.controls.back_button.clicked.connect(lambda lt: self.labeltool.gotoPrevious()) self.controls.forward_button.clicked.connect(lambda lt: self.labeltool.gotoNext()) self.central_layout.addWidget(self.controls) self.central_layout.addWidget(self.view) self.central_widget.setLayout(self.central_layout) self.setCentralWidget(self.central_widget) self.initShortcuts(config.HOTKEYS) self.initOptions() self.initAnnotationMenu() self.treeview = AnnotationTreeView() self.treeview.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Preferred) self.ui.dockAnnotations.setWidget(self.treeview) self.scene.selectionChanged.connect(self.scene.onSelectionChanged) self.treeview.selectedItemsChanged.connect(self.scene.onSelectionChangedInTreeView) self.posinfo = QLabel("-1, -1") self.posinfo.setFrameStyle(QFrame.StyledPanel) self.statusBar().addPermanentWidget(self.posinfo) self.scene.mousePositionChanged.connect(self.onMousePositionChanged) self.image_resolution = QLabel("[no image]") self.image_resolution.setFrameStyle(QFrame.StyledPanel) self.statusBar().addPermanentWidget(self.image_resolution) self.zoominfo = QLabel() self.zoominfo.setFrameStyle(QFrame.StyledPanel) self.statusBar().addPermanentWidget(self.zoominfo) self.view.scaleChanged.connect(self.onScaleChanged) self.onScaleChanged(self.view.getScale()) self.sb_progress = QProgressBar() # View menu self.ui.menu_Views.addAction(self.ui.dockProperties.toggleViewAction()) self.ui.menu_Views.addAction(self.ui.dockAnnotations.toggleViewAction()) # Annotation menu self.copyAnnotations = CopyAnnotations(self.labeltool) self.interpolateRange = InterpolateRange(self.labeltool) # Show the UI. It is important that this comes *after* the above # adding of custom widgets, especially the central widget. Otherwise the # dock widgets would be far to large. self.ui.show() ## connect action signals self.connectActions()
def initUI(self): global button1 global button2 global button3 global button4 global button5 self.setWindowTitle(self.title) self.setMaximumSize(620, 400) self.setMinimumSize(620, 700) self.setGeometry(self.left, self.top, self.width, self.height) self.setWindowIcon(QIcon("images.ico")) button1 = QPushButton('Select Files', self) button1.setToolTip('This is an example button') button1.move(70, 60) button1.resize(100, 30) button1.clicked.connect(self.openFileNamesDialog) button2 = QPushButton('Run for All', self) button2.setToolTip('This is an example button') button2.move(70, 480) button2.resize(240, 30) button2.clicked.connect(self.trim) button2.setEnabled(False) button3 = QPushButton('Run for Affacted', self) button3.setToolTip('This is an example button') button3.move(310, 450) button3.resize(240, 30) button3.clicked.connect(self.trim_affacted) button3.setEnabled(False) button4 = QPushButton('Check Affacted Files', self) button4.setToolTip('This is an example button') button4.move(70, 450) button4.resize(240, 30) button4.clicked.connect(self.check_Extra_spaces, ) button4.setEnabled(False) button5 = QPushButton('Reset', self) button5.setToolTip('This is an example button') button5.move(310, 480) button5.resize(240, 30) button5.clicked.connect(self.reset) button5.setEnabled(False) button6 = QPushButton('Close', self) button6.setToolTip('This is an example button') button6.move(450, 630) button6.resize(100, 30) button6.clicked.connect(self.close_window) # button7 = QPushButton('See logs', self) # button7.setToolTip('This is an example button') # button7.move(250, 630) # button7.resize(100, 30) # button7.clicked.connect(self.openpop_up) label2 = QLabel('Set Output Path :', self) label2.move(70, 155) global textbox1 global textbox2 global textbox3 global model, list1 textbox1 = QLineEdit(self) textbox1.move(170, 60) textbox1.resize(380, 30) textbox1.setReadOnly(True) textbox2 = QLineEdit(desktop, self) textbox2.move(170, 150) textbox2.resize(380, 30) list1 = QListView(self) list1.setWindowTitle('Affected File List') list1.setMinimumSize(100, 200) list1.move(70, 240) list1.resize(480, 26) list1.setEditTriggers(QAbstractItemView.NoEditTriggers) global progress progress = QProgressBar(self) progress.move(70, 530) progress.resize(500, 26) progress.setValue(0) self.show()
def __init__(self, context: ApplicationContext, manager: SoftwareManager, screen_size: QSize, i18n: I18n, manage_window: QWidget, app_config: dict): super(PreparePanel, self).__init__(flags=Qt.CustomizeWindowHint | Qt.WindowTitleHint) self.i18n = i18n self.context = context self.app_config = app_config self.manage_window = manage_window self.setWindowTitle('{} ({})'.format( __app_name__, self.i18n['prepare_panel.title.start'].lower())) self.setMinimumWidth(screen_size.width() * 0.5) self.setMinimumHeight(screen_size.height() * 0.35) self.setMaximumHeight(screen_size.height() * 0.95) self.setLayout(QVBoxLayout()) self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred) self.manager = manager self.tasks = {} self.output = {} self.added_tasks = 0 self.ftasks = 0 self.started_at = None self.self_close = False self.prepare_thread = Prepare(self.context, manager, self.i18n) self.prepare_thread.signal_register.connect(self.register_task) self.prepare_thread.signal_update.connect(self.update_progress) self.prepare_thread.signal_finished.connect(self.finish_task) self.prepare_thread.signal_started.connect(self.start) self.prepare_thread.signal_ask_password.connect(self.ask_root_password) self.prepare_thread.signal_output.connect(self.update_output) self.signal_password_response.connect( self.prepare_thread.set_password_reply) self.check_thread = CheckFinished() self.signal_status.connect(self.check_thread.update) self.check_thread.signal_finished.connect(self.finish) self.skip_thread = EnableSkip() self.skip_thread.signal_timeout.connect(self._enable_skip_button) self.progress_thread = AnimateProgress() self.progress_thread.signal_change.connect(self._change_progress) self.label_top = QLabel() self.label_top.setCursor(QCursor(Qt.WaitCursor)) self.label_top.setText("{}...".format( self.i18n['prepare_panel.title.start'].capitalize())) self.label_top.setObjectName('prepare_status') self.label_top.setAlignment(Qt.AlignHCenter) self.layout().addWidget(self.label_top) self.layout().addWidget(QLabel()) self.table = QTableWidget() self.table.setObjectName('tasks') self.table.setCursor(QCursor(Qt.WaitCursor)) self.table.setFocusPolicy(Qt.NoFocus) self.table.setShowGrid(False) self.table.verticalHeader().setVisible(False) self.table.horizontalHeader().setVisible(False) self.table.horizontalHeader().setSizePolicy( QSizePolicy.MinimumExpanding, QSizePolicy.Preferred) self.table.setColumnCount(4) self.table.setHorizontalHeaderLabels(['' for _ in range(4)]) self.table.horizontalScrollBar().setCursor( QCursor(Qt.PointingHandCursor)) self.table.verticalScrollBar().setCursor(QCursor( Qt.PointingHandCursor)) self.layout().addWidget(self.table) self.textarea_details = QPlainTextEdit(self) self.textarea_details.setObjectName('task_details') self.textarea_details.setProperty('console', 'true') self.textarea_details.resize(self.table.size()) self.layout().addWidget(self.textarea_details) self.textarea_details.setVisible(False) self.textarea_details.setReadOnly(True) self.textarea_details.setMaximumHeight(100) self.current_output_task = None self.bottom_widget = QWidget() self.bottom_widget.setLayout(QHBoxLayout()) self.bottom_widget.layout().addStretch() bt_hide_details = QPushButton(self.i18n['prepare.bt_hide_details']) bt_hide_details.setObjectName('bt_hide_details') bt_hide_details.clicked.connect(self.hide_output) bt_hide_details.setCursor(QCursor(Qt.PointingHandCursor)) self.bottom_widget.layout().addWidget(bt_hide_details) self.bottom_widget.layout().addStretch() self.layout().addWidget(self.bottom_widget) self.bottom_widget.setVisible(False) self.bt_bar = QCustomToolbar() self.bt_close = QPushButton(self.i18n['close'].capitalize()) self.bt_close.setObjectName('bt_cancel') self.bt_close.setCursor(QCursor(Qt.PointingHandCursor)) self.bt_close.clicked.connect(self.close) self.bt_close.setVisible(False) self.bt_bar.add_widget(self.bt_close) self.bt_bar.add_widget(new_spacer()) self.progress_bar = QProgressBar() self.progress_bar.setObjectName('prepare_progress') self.progress_bar.setTextVisible(False) self.progress_bar.setVisible(False) self.progress_bar.setCursor(QCursor(Qt.WaitCursor)) self.bt_bar.add_widget(self.progress_bar) self.bt_bar.add_widget(new_spacer()) self.bt_skip = QPushButton( self.i18n['prepare_panel.bt_skip.label'].capitalize()) self.bt_skip.clicked.connect(self.finish) self.bt_skip.setEnabled(False) self.bt_skip.setCursor(QCursor(Qt.WaitCursor)) self.bt_bar.add_widget(self.bt_skip) self.layout().addWidget(self.bt_bar)
def __init__(self, pkg: PackageView, http_client: HttpClient, icon_cache: MemoryCache, i18n: I18n, screenshots: List[QPixmap], logger: logging.Logger): super(ScreenshotsDialog, self).__init__() self.setWindowTitle(str(pkg)) self.screenshots = screenshots self.logger = logger self.loaded_imgs = [] self.download_threads = [] self.resize(1280, 720) self.i18n = i18n self.http_client = http_client self.progress_bar = QProgressBar() self.progress_bar.setMaximumHeight(10 if QApplication.instance().style( ).objectName().lower() == 'windows' else 6) self.progress_bar.setTextVisible(False) self.thread_progress = AnimateProgress() self.thread_progress.signal_change.connect(self._update_progress) self.thread_progress.start() # THERE ARE CRASHES WITH SOME RARE ICONS ( like insomnia ). IT CAN BE A QT BUG. IN THE MEANTIME, ONLY THE TYPE ICON WILL BE RENDERED # # icon_data = icon_cache.get(pkg.model.icon_url) # # if icon_data and icon_data.get('icon'): # self.setWindowIcon(icon_data.get('icon')) # else: # self.setWindowIcon(QIcon(pkg.model.get_type_icon_path())) self.setWindowIcon(QIcon(pkg.model.get_type_icon_path())) self.setLayout(QVBoxLayout()) self.img = QLabel() self.layout().addWidget(self.img) self.bottom_bar = QToolBar() self.bt_back = QPushButton( ' < ' + self.i18n['screenshots.bt_back.label'].capitalize()) self.bt_back.setCursor(QCursor(Qt.PointingHandCursor)) self.bt_back.clicked.connect(self.back) self.ref_bt_back = self.bottom_bar.addWidget(self.bt_back) self.bottom_bar.addWidget(new_spacer(50)) self.img_label = QLabel() self.img_label.setStyleSheet( 'QLabel { font-weight: bold; text-align: center }') self.ref_img_label = self.bottom_bar.addWidget(self.img_label) self.ref_img_label.setVisible(False) self.ref_progress_bar = self.bottom_bar.addWidget(self.progress_bar) self.bottom_bar.addWidget(new_spacer(50)) self.bt_next = QPushButton( self.i18n['screenshots.bt_next.label'].capitalize() + ' > ') self.bt_next.setCursor(QCursor(Qt.PointingHandCursor)) self.bt_next.clicked.connect(self.next) self.ref_bt_next = self.bottom_bar.addWidget(self.bt_next) self.layout().addWidget(self.bottom_bar) self.img_idx = 0 for idx, s in enumerate(self.screenshots): t = Thread(target=self._download_img, args=(idx, s), daemon=True) t.start() self._load_img()
def initUI(self): self.motor1 = QProgressBar(self) self.motor1.setGeometry(150, 100, 100, 200) self.motor1.setValue(0) self.motor2 = QProgressBar(self) self.motor2.setGeometry(150, 320, 100, 200) self.motor2.setValue(0) self.motor3 = QProgressBar(self) self.motor3.setGeometry(250, 100, 100, 200) self.motor3.setValue(0) self.motor4 = QProgressBar(self) self.motor4.setGeometry(250, 320, 100, 200) self.motor4.setValue(0) self.elv1 = QPushButton(self) self.elv1.setGeometry(500, 100, 50, 50) self.Elv1 = QtWidgets.QLabel(self) self.Elv1.setGeometry(500, 150, 200, 50) self.Elv1.setText('Elevators') self.elv2 = QPushButton(self) self.elv2.setGeometry(600, 100, 50, 50) self.Left = QPushButton(self) self.Left.setGeometry(150, 20, 50, 50) self.Left.setText('L') self.Right = QPushButton(self) self.Right.setGeometry(250, 20, 50, 50) self.Right.setText('R') self.dist = QPushButton(self) self.dist.setGeometry(20, 670, 100, 50) self.dist.setText('Distance:') self.time = QPushButton(self) self.time.setGeometry(340, 670, 100, 50) self.time.setText('Time:') self.dist1 = QPushButton(self) self.dist1.setGeometry(140, 670, 100, 50) self.dist2 = QPushButton(self) self.dist2.setGeometry(140, 750, 100, 50) self.time1 = QPushButton(self) self.time1.setGeometry(460, 670, 100, 50) self.time2 = QPushButton(self) self.time2.setGeometry(460, 750, 100, 50) self.auto1 = QPushButton(self) self.auto1.setGeometry(600, 670, 40, 40) self.auto1.setText('1') self.auto1.clicked.connect(self.A1) self.auto2 = QPushButton(self) self.auto2.setGeometry(640, 670, 40, 40) self.auto2.clicked.connect(self.A2) self.auto2.setText('2') self.auto3 = QPushButton(self) self.auto3.setGeometry(680, 670, 40, 40) self.auto3.setText('3') self.auto3.clicked.connect(self.A3) self.auto4 = QPushButton(self) self.auto4.setGeometry(720, 670, 40, 40) self.auto4.setText('4') self.auto4.clicked.connect(self.A4) self.auto5 = QPushButton(self) self.auto5.setGeometry(760, 670, 40, 40) self.auto5.setText('5') self.auto5.clicked.connect(self.A5) self.auto6 = QPushButton(self) self.auto6.setGeometry(800, 670, 40, 40) self.auto6.setText('6') self.auto6.clicked.connect(self.A6) self.auto7 = QPushButton(self) self.auto7.setGeometry(840, 670, 40, 40) self.auto7.setText('7') self.auto7.clicked.connect(self.A7) self.auto8 = QPushButton(self) self.auto8.setGeometry(880, 670, 40, 40) self.auto8.setText('8') self.auto8.clicked.connect(self.A8) self.auto9 = QPushButton(self) self.auto9.setGeometry(920, 670, 40, 40) self.auto9.setText('9') self.auto9.clicked.connect(self.A9) self.auto10 = QPushButton(self) self.auto10.setGeometry(960, 670, 40, 40) self.auto10.setText('10') self.auto10.clicked.connect(self.A10) self.auto11 = QPushButton(self) self.auto11.setGeometry(1000, 670, 40, 40) self.auto11.setText('11') self.auto11.clicked.connect(self.A11) self.auto12 = QPushButton(self) self.auto12.setGeometry(1040, 670, 40, 40) self.auto12.setText('12') self.auto12.clicked.connect(self.A12) self.ToBe = QPushButton(self) self.ToBe.setGeometry(800, 750, 100, 50) self.ToBe.setText('not running') self.driNum = QPushButton(self) self.driNum.setGeometry(800, 250, 50, 50) self.Gyro = QPushButton(self) self.Gyro.setGeometry(900, 320, 50, 50) self.Gyro.setText('0') self.ArmState = QPushButton(self) self.ArmState.setGeometry(1000, 390, 200, 50) self.ArmState.setText('not sure') self.gyro = QtWidgets.QLabel(self) self.gyro.setGeometry(900, 250, 100, 50) self.gyro.setText('gyro:') self.arm = QtWidgets.QLabel(self) self.arm.setGeometry(1000, 320, 100, 50) self.arm.setText('arm:') self.AutoMATA = QtWidgets.QLabel(self) self.AutoMATA.setGeometry(600, 750, 250, 50) self.AutoMATA.setText('Current autonomous code:') self.driFac = QtWidgets.QLabel(self) self.driFac.setGeometry(800, 170, 200, 50) self.driFac.setText('driver factor:') ''' self.btn1 = QPushButton(self) self.btn1.setGeometry(130, 40, 200, 25) self.l1=QtWidgets.QLabel(self) self.l1.setGeometry(30,40,50,25) self.l1.setText('Left') self.btn2 = QPushButton(self) self.btn2.setGeometry(130, 75, 200, 25) self.l1=QtWidgets.QLabel(self) self.l1.setGeometry(30,75,50,25) self.l1.setText('Right') self.btn3 = QPushButton(self) self.btn3.setGeometry(130, 110, 200, 25) self.l1=QtWidgets.QLabel(self) self.l1.setGeometry(30,110,50,25) self.l1.setText('Camera') self.btn4 = QPushButton(self) self.btn4.setGeometry(130, 145, 200, 25) self.l1=QtWidgets.QLabel(self) self.l1.setGeometry(30,145,50,25) self.l1.setText('Gyro') self.atbt1 = QPushButton(self) self.atbt1.setGeometry(30,180,50,25) self.atbt1.setText('1') self.atbt1.clicked.connect(self.changeat1) self.atbt1 = QPushButton(self) self.atbt1.setGeometry(90,180,50,25) self.atbt1.setText('2') self.atbt1.clicked.connect(self.changeat2) self.atbt1 = QPushButton(self) self.atbt1.setGeometry(150,180,50,25) self.atbt1.setText('3') self.atbt1.clicked.connect(self.changeat3) self.atbt1 = QPushButton(self) self.atbt1.setGeometry(210,180,50,25) self.atbt1.setText('4') self.atbt1.clicked.connect(self.changeat4) ''' self.timer = QBasicTimer() self.step = 0 self.timer.start(100, self) self.setGeometry(100, 100, 1500, 900) self.setWindowTitle('Input dialog') self.show()
def initUI(self): self.setAutoFillBackground(True) pattern = self.palette() pattern.setColor(QtGui.QPalette.Background, QColor("#EFFCFC")) self.setPalette(pattern) mainLayout = QVBoxLayout() uploadButton = QPushButton() uploadButton.setObjectName("upload") uploadButton.setCursor(QtCore.Qt.PointingHandCursor) uploadButton.clicked.connect(self.handleOpenPDF) icon = QtGui.QIcon() iconPath = appctxt.get_resource("images/pdf.png") icon.addPixmap(QtGui.QPixmap(iconPath)) uploadButton.setIcon(icon) uploadButton.setIconSize(QSize(30, 30)) note = QLabel( '如何分页,默认为1,也可以自定义, Exp * [2] 表示每隔2页分隔成一个PDF * [2,3] 表示第一个文档取前2页,第二个文档取接下去的3页,3. * [1-2,3-5] 表示 1~2页分割成一个文档, 3~5页分割成一个文档' ) note.setObjectName('note') note.setWordWrap(True) self.outputFileName = QLineEdit() self.outputFileName.setPlaceholderText('输出文件名称') self.outputFileName.setDisabled(True) # self.compressCheckBox = QCheckBox() # self.compressCheckBox.setText("输出文件是否打包压缩") self.categoryByTime = QCheckBox() self.categoryByTime.setText("输出文件夹按时间分类") state = 0 if self.config['byTime'] == True: state = 2 else: state = 0 self.categoryByTime.setCheckState(state) self.categoryByTime.stateChanged.connect(self.byTimeChecked) self.categoryByTime.setDisabled(True) self.outputFold = ClickableLineEdit() self.outputFold.setText(self.outputFoldPath) self.outputFold.setPlaceholderText("输出文件夹位置") self.outputFold.clicked.connect(self.selectOutputFold) self.outputFold.textChanged.connect(self.textChangedOutputFold) self.outputFold.setDisabled(True) doButton = QPushButton("执行") doButton.setObjectName("do") doButton.setCursor(QtCore.Qt.PointingHandCursor) doButton.clicked.connect(self.handleSplitPDF) doButton.setDisabled(True) self.doButton = doButton self.splitWay = QLineEdit() self.splitWay.setText(self.splitWayValue) self.splitWay.textChanged.connect(self.splitWayChange) self.splitWay.setDisabled(True) self.fileName = QLabel('文件名称') self.pageNumber = QLabel("文件页数") self.fileSize = QLabel("文件大小") self.updateTime = QLabel("文件最近更新时间") self.setLayout(mainLayout) self.setGeometry(300, 200, 500, 600) self.setWindowTitle('PDF 分割工具') self.progressStatus = QProgressBar() self.progressStatus.setObjectName("progressBar") self.progressStatus.setGeometry(0, 0, 500, 20) self.progressStatus.setMaximum(100) self.progressStatus.setMinimum(0) self.progressStatus.setTextVisible(False) self.progressStatus.setVisible(False) # self.progressStatus.setHidden(True) headerGridGroup = QGroupBox() bodyGridGroup = QGroupBox() gridHeaderLayout = QGridLayout() gridHeaderLayout.addWidget(uploadButton, 1, 1, 4, 1) # row 1 col 2 gridHeaderLayout.addWidget(self.fileName, 1, 2, 1, 1) gridHeaderLayout.addWidget(self.pageNumber, 2, 2, 1, 1) gridHeaderLayout.addWidget(self.fileSize, 3, 2, 1, 1) gridHeaderLayout.addWidget(self.updateTime, 4, 2, 1, 1) gridBodyLayout = QGridLayout() gridBodyLayout.addWidget(self.outputFileName, 2, 1, 1, 2) # row 2 col 1 gridBodyLayout.addWidget(self.outputFold, 3, 1, 1, 2) gridBodyLayout.addWidget(self.categoryByTime, 4, 1, 1, 2) gridBodyLayout.addWidget(note, 7, 1, 1, 2) gridBodyLayout.addWidget(self.splitWay, 8, 1, 1, 2) gridBodyLayout.addWidget(doButton, 9, 2, 1, 1) gridBodyLayout.addWidget(self.progressStatus, 10, 1, 1, 2) headerGridGroup.setLayout(gridHeaderLayout) bodyGridGroup.setLayout(gridBodyLayout) mainLayout.addWidget(headerGridGroup) mainLayout.addWidget(bodyGridGroup)
def init_ui(self): ''' # 窗体GUI部分 :return: ''' # 设置窗体大小 self.setGeometry(500, 200, 350, 200) # 设置固定大小 self.setFixedSize(490, 370) self.setWindowTitle('文件名称提取程序') self.setWindowIcon(QIcon('icon/769160.png')) self.setMinimumHeight(800) # 设置软件过期时间 data = '2019-8-21 13:50:00' data_array = time.strptime(data, "%Y-%m-%d %H:%M:%S") timeStamp = int(time.mktime(data_array)) # print(timeStamp) # 判断软件是否过期 if time.time() > timeStamp: QMessageBox.warning(self, '', '软件已过期,请联系作者', QMessageBox.Yes) else: # 进度条 self.pbar = QProgressBar(self) # 进图条位置及大小 self.pbar.setGeometry(20, 200, 480, 20) # todo 按钮 # 选择文件按钮 self.btn_select_file = QPushButton('选择文件夹', self) self.btn_select_file.move(20, 230) self.btn_select_file.setFixedSize(125, 20) self.btn_select_file.clicked.connect(self.file_dialog) # 输出文件按钮 self.btn_output_path = QPushButton('选择输出文件夹', self) self.btn_output_path.move(20, 270) self.btn_output_path.setFixedSize(125, 20) self.btn_output_path.clicked.connect(self.output_dialog) # 开始按钮 self.btn = QPushButton('开始', self) # 创建按钮并移动 self.btn.move(150, 310) self.btn.setFixedSize(200, 40) # 点击按钮,连接事件函数 self.btn.clicked.connect(self.btn_action) # todo 标签 # 文件路径标签 self.lab_select_path = QLabel('文件路径', self) self.lab_select_path.move(150, 230) self.lab_select_path.setFixedSize(320, 20) self.lab_select_path.setFrameShape(QFrame.Box) self.lab_select_path.setFrameShadow(QFrame.Raised) # 输出标签 self.lab_output_path = QLabel('文件路径', self) self.lab_output_path.move(150, 270) self.lab_output_path.setFixedSize(320, 20) self.lab_output_path.setFrameShape(QFrame.Box) self.lab_output_path.setFrameShadow(QFrame.Raised) # 说明标签 content = '说明:\n 选择需要提取名称的文件夹;选择输出结果文件夹。\n' self.description_lab = QLabel(content, self) self.description_lab.move(20, 10) self.description_lab.setFixedSize(450, 170) self.description_lab.setAlignment(Qt.AlignTop) self.description_lab.setFrameShape(QFrame.Box) self.description_lab.setFrameShadow(QFrame.Raised) # 自动换行 # self.description_lab.adjustSize() self.description_lab.setWordWrap(True) self.step = 0 # 显示 self.show()
def initUI(self): self.setGeometry(600, 300, 1000, 600) self.center() self.setWindowTitle("Plot Trajectory") mainMenu = self.menuBar() fileMenu = mainMenu.addMenu("File") saveAction = QAction("Save as...") saveAction.setShortcut("Ctrl+S") saveAction.setStatusTip("Save plot to file") saveAction.setMenuRole(QAction.NoRole) saveAction.triggered.connect(self.file_save) fileMenu.addAction(saveAction) exitAction = QAction("&Exit", self) exitAction.setShortcut("Ctrl+Q") exitAction.setStatusTip("Exit Application") exitAction.setMenuRole(QAction.NoRole) exitAction.triggered.connect(self.close) fileMenu.addAction(exitAction) settingsMenu = mainMenu.addMenu("Settings") self.setStyleMenu = QMenu("Set Style", self) settingsMenu.addMenu(self.setStyleMenu) for style_name in [ "default", "fast", "ggplot", "grayscale", "seaborn" ]: styleAction = QAction(style_name, self, checkable=True) if style_name is CUR_STYLE: styleAction.setChecked(True) styleAction.triggered.connect(partial(self.set_style, style_name)) self.setStyleMenu.addAction(styleAction) self.setTimeWindowMenu = QMenu("Set Time Window", self) settingsMenu.addMenu(self.setTimeWindowMenu) for window_str in ["None", "s", "30s", "H", "D"]: windowAction = QAction(window_str, self, checkable=True) if window_str is TIME_WINDOW: windowAction.setChecked(True) windowAction.triggered.connect( partial(self.set_time_window, window_str)) self.setTimeWindowMenu.addAction(windowAction) # Grid Layout grid = QtWidgets.QGridLayout() widget = QtWidgets.QWidget(self) self.setCentralWidget(widget) widget.setLayout(grid) # Import CSV Button btn1 = QtWidgets.QPushButton("Import CSV", self) btn1.resize(btn1.sizeHint()) btn1.clicked.connect(self.getCSV) grid.addWidget(btn1, 1, 0) # Canvas and Toolbar self.figure = plt.figure(figsize=(15, 5)) self.canvas = FigureCanvas(self.figure) self.canvas.setContextMenuPolicy(Qt.CustomContextMenu) self.canvas.customContextMenuRequested.connect(self.popup) grid.addWidget(self.canvas, 2, 0, 1, 2) # DropDown mean / comboBox self.df = pd.DataFrame() self.columns = [] self.plot_list = [] self.comboBox = QtWidgets.QComboBox(self) self.comboBox.addItems(self.columns) grid.addWidget(self.comboBox, 0, 0) self.comboBox2 = QtWidgets.QComboBox(self) self.comboBox2.addItems(self.plot_list) grid.addWidget(self.comboBox2, 0, 1) # Plot Button btn2 = QtWidgets.QPushButton("Plot", self) btn2.resize(btn2.sizeHint()) btn2.clicked.connect(self.plot) grid.addWidget(btn2, 1, 1) # Progress bar self.progress = QProgressBar(self) # self.progress.setRange(0, 1) grid.addWidget(self.progress, 3, 0, 1, 2) self.statusBar = QStatusBar() self.setStatusBar(self.statusBar) self.show()