def error_dialog(text): DialogWindow = QtWidgets.QDialog() setupwin = dialog.Ui_Dialog() setupwin.setupUi(DialogWindow) setupwin.retranslateUi(DialogWindow, text) DialogWindow.setWindowModality(QtCore.Qt.ApplicationModal) DialogWindow.exec_()
def init_dialog(self): # self.last_check_file_all_time=0 self.di = QtWidgets.QDialog() self.d = dialog.Ui_Dialog() self.d.setupUi(self.di) self.di.setWindowIcon(QtGui.QIcon('icon/logo.png')) self.di.setWindowTitle("常规文件检查配置") # self.di.show() self.read_dialog_config(self.d) self.d.add_com_src.clicked.connect(lambda: self.file_path(self.d)) self.d.com_config.clicked.connect(self.di.reject) # self.d.com_config.clicked.connect(lambda: self.count_time()) self.d.com_config.clicked.connect(lambda: self.complete_config(self.d)) self.pushButton.clicked.connect(lambda: self.complete_config(self.d)) self.d.default_config.clicked.connect( lambda: self.read_dialog_config(self.d)) self.d.clean_com_src.clicked.connect( lambda: self.clean_dialog_table(self.d)) for all_type in [ "self.d.all_micsoft_type", "self.d.all_wps_type", "self.d.all_compress_type" ]: eval(all_type).stateChanged.connect( lambda: self.all_type_state_change(self.d))
def __init__( self, parent, major: ArabicMnemonicMajor, search_text: str = "", word_to_num_checked: bool = False, ): QDialog.__init__(self, parent) self.form = armjaor_form.Ui_Dialog() self.form.setupUi(self) self.form.lineEdit.setFocus() self.form.lineEdit.setText(search_text) self.form.searchButton.clicked.connect(self.accept) # type: ignore self.form.copySelectedButton.clicked.connect( self.on_copy_selected) # type: ignore focusSearchHotkey = QShortcut(QKeySequence("Ctrl+F"), self) focusSearchHotkey.activated.connect( self.form.lineEdit.setFocus) # type: ignore self.form.wordToNum.toggled.connect( self.on_mode_changed) # type: ignore self.form.wordToNum.setChecked(word_to_num_checked) changeModeHotkey = QShortcut(QKeySequence("Ctrl+W"), self) changeModeHotkey.activated.connect(self.toggle_mode) # type: ignore self.major = major if search_text.strip(): self.accept()
def show_dialog(self, status): #程序操作反馈对话框 QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling) self.Dialog = QtWidgets.QDialog() ui = dialog.Ui_Dialog() ui.setupUi(self.Dialog, status) self.Dialog.show()
def click_button(self): Dialog = QtWidgets.QDialog() ui = dialog.Ui_Dialog() ui.setupUi(Dialog) Dialog.show() # Dialog.exec_() rsp = Dialog.exec_() if rsp == QtWidgets.QDialog.Accepted: self.label.setText("点击了OK") else: self.label.setText("点击了Cannel")
import dialog import sys from PyQt5.QtWidgets import QApplication from PyQt5.QtWidgets import QDialog app = QApplication(sys.argv) dlg = dialog.Ui_Dialog() qtDlg = QDialog() dlg.setupUi(qtDlg) qtDlg.show() exit(app.exec_())
def __init__(self, p): super(DialogWindow, self).__init__(parent=p) self.ui = dialog.Ui_Dialog() self.ui.setupUi(self)
def show_dialog(self): import dialog Dialog = QtWidgets.QDialog() o=dialog.Ui_Dialog() o.show()
import sys from PyQt5.QtWidgets import QApplication, QDialog import dialog app = QApplication([]) di = dialog.Ui_Dialog() d = QDialog() di.setupUi(d) d.show() sys.exit(app.exec_())
def exit_from_menu(): Form.close() if __name__ == '__main__': # objects app = QtGui.QApplication(sys.argv) # main form objects: the form itself and its UI Form = QtGui.QMainWindow() Form_ui = window.Ui_Form() Form_ui.setupUi(Form) # Add position dialog object and its UI Dlg = QtGui.QDialog() Dlg_ui = dialog.Ui_Dialog() Dlg_ui.setupUi(Dlg) # Storage object which define current .json file path Stor = storage.Storage() Stor.setup() # Main table object and UI. Displaying all trades since # the program start Tbl = tables.Trade_table() Tbl.setup(Form_ui.tableWidget, Stor.entries_count()) Tbl.all_trades(Form_ui.tableWidget, Stor.init_list()) # Table from the Add dialog Add_Tbl = tables.Add_table() Add_Tbl.setup(Dlg_ui.tableWidget)
def __init__(self, msg="正在预测,请勿关闭应用程序!"): QDialog.__init__(self) self.msg_dialog = dialog.Ui_Dialog() self.msg_dialog.setupUi(self, msg)
def newProject(self): Dialog = QtWidgets.QDialog(self.centralwidget) ui_dialog = dialog.Ui_Dialog() ui_dialog.setupUi(Dialog) Dialog.show()
def __init__(self, parent=None): #クラスの初期化 super(MyDialog, self).__init__(parent) self.ui = dialog.Ui_Dialog() #先ほど作ったhello.pyの中にあるクラスの self.ui.setupUi(self) #このコマンドを実行する