def __init__(self, parent=None): """ Create panel. Arguments: parent (Optional[QWidget]): Parent widget. Defaults to *None*. """ Q.QFrame.__init__(self, parent) self.setFrameStyle(Q.QFrame.Box | Q.QFrame.Sunken) self.setSizePolicy(Q.QSizePolicy.Expanding, Q.QSizePolicy.Expanding) self._icon = Q.QLabel(self) self._icon.setSizePolicy(Q.QSizePolicy.Fixed, Q.QSizePolicy.Fixed) self._title = Q.QLabel(self) base = Q.QWidget(self) self._container = Q.QVBoxLayout(base) self._container.setContentsMargins(0, 0, 0, 0) self._buttonbox = Q.QDialogButtonBox(Q.Qt.Horizontal, self) v_layout = Q.QVBoxLayout(self) h_layout = Q.QHBoxLayout() h_layout.addWidget(self._icon) h_layout.addWidget(self._title) v_layout.addLayout(h_layout) v_layout.addWidget(HLine(self)) v_layout.addWidget(base) v_layout.addWidget(self._buttonbox) self._buttonbox.clicked.connect(self._clicked) self.hide()
def __init__(self, parent, availableAddons): super(AddAddonDlg, self).__init__(parent) box = Qt.QVBoxLayout(self) box.addWidget( Qt.QLabel( self.tr("Type name or url of the addon you want to add:"), self)) self.input = Qt.QLineEdit(self) box.addWidget(self.input) btnBox = Qt.QDialogButtonBox(Qt.QDialogButtonBox.Ok | Qt.QDialogButtonBox.Cancel) btnBox.accepted.connect(self.accept) btnBox.rejected.connect(self.reject) box.addWidget(btnBox) self.show() if len(availableAddons) > 0: self.completer = Qt.QCompleter( [addon[0] for addon in availableAddons], self) self.completer.setFilterMode(Qt.Qt.MatchContains) self.completer.setCaseSensitivity(Qt.Qt.CaseInsensitive) self.input.setCompleter(self.completer) else: Qt.QMessageBox.information( self, self.tr("No addon catalog data"), self. tr("You haven't updated the available addons catalog, " "so you need to insert a URL for the addon you want to add." ))
def __init__(self, parent): super(AboutDlg, self).__init__(parent) settings = Qt.QSettings() print(settings.applicationName(), settings.organizationName()) print("Groups", settings.childGroups()) for key in settings.allKeys(): print("KEY: {}:{}".format(key, settings.value(key))) prefix = settings.value(defines.WOW_VERSION_KEY) print("prefix", prefix) prefix = settings.value("version") print("prefix", prefix) settings.beginGroup(prefix) box = Qt.QVBoxLayout(self) box.addWidget(Qt.QLabel("Lcurse version: {}".format(VERSION), self)) settings = Qt.QSettings() box.addWidget(Qt.QLabel("Wow version: {}".format(prefix), self)) settings.beginGroup(prefix) box.addWidget( Qt.QLabel( "Wow path: {}".format(settings.value(defines.WOW_FOLDER_KEY)), self)) box.addWidget( Qt.QLabel( "Wow toc: {}".format(settings.value(defines.WOW_TOC_KEY)), self)) settings.endGroup() btnBox = Qt.QDialogButtonBox(Qt.QDialogButtonBox.Ok) btnBox.accepted.connect(self.close) box.addWidget(btnBox) self.show()
def __init__(self, parent: QWidget, images: Images): super(MetadataDialog, self).__init__(parent) self.setWindowTitle('Image Metadata') self.setSizeGripEnabled(True) self.resize(600, 300) main_widget = MetadataDialog.build_metadata_tree(images.metadata) buttons = Qt.QDialogButtonBox(Qt.QDialogButtonBox.Ok) buttons.accepted.connect(self.accept) layout = Qt.QVBoxLayout() layout.addWidget(main_widget) layout.addWidget(buttons) self.setLayout(layout)
def __init__(self, device_rows, parent=None): super().__init__(parent) self.device_rows = device_rows self.setModal(True) self.setWindowModality(Qt.Qt.WindowModal) self.setWindowTitle('Select Gamepad/Joystick') self.setSizeGripEnabled(True) self.resize(865, 400) self.button_box = Qt.QDialogButtonBox( Qt.QDialogButtonBox.Ok | Qt.QDialogButtonBox.Cancel, Qt.Qt.Horizontal) self.button_box.accepted.connect(self.accept) self.button_box.rejected.connect(self.reject) self.connect_button = self.button_box.button(Qt.QDialogButtonBox.Ok) self.connect_button.setText('Connect') l = Qt.QVBoxLayout() self.setLayout(l) self.table_widget = Qt.QTableWidget() self.table_widget.setEditTriggers(Qt.QAbstractItemView.NoEditTriggers) self.table_widget.setSelectionMode( Qt.QAbstractItemView.SingleSelection) self.table_widget.setSelectionBehavior(Qt.QAbstractItemView.SelectRows) self.table_widget.setDragDropMode(Qt.QAbstractItemView.NoDragDrop) self.table_widget.setColumnCount(3) f = Qt.QFont() f.setFamily('Monospace') twi = Qt.QTableWidgetItem('ID') twi.setFont(f) self.table_widget.setHorizontalHeaderItem(0, twi) self.table_widget.setHorizontalHeaderItem(1, Qt.QTableWidgetItem('Type')) self.table_widget.setHorizontalHeaderItem(2, Qt.QTableWidgetItem('Name')) l.addWidget(self.table_widget) l.addWidget(self.button_box) sm = self.table_widget.selectionModel() sm.currentRowChanged.connect(self.on_table_widget_current_row_changed) self.selected_device_row = None self.table_widget.setRowCount(len(self.device_rows)) sm.clear() for r_idx, r in enumerate(self.device_rows): self.table_widget.setItem(r_idx, 0, Qt.QTableWidgetItem(str(r[0]))) self.table_widget.setItem(r_idx, 1, Qt.QTableWidgetItem(r[1])) self.table_widget.setItem(r_idx, 2, Qt.QTableWidgetItem(r[2])) if self.device_rows: self.table_widget.resizeColumnsToContents() sm.select(sm.model().index(0, 0), sm.Rows | sm.Current | sm.Select)
def __init__(self, parent): self.settings=Qt.QSettings() self.current=self.settings.value(defines.WOW_VERSION_KEY) super(ChooserDlg, self).__init__(parent) box = Qt.QVBoxLayout(self) box.addWidget(Qt.QLabel(self.tr("Select your WoW Version"), self)) self.buttons=[] for v in self.settings.childGroups(): button=Qt.QRadioButton(v) button.setChecked(1 if v == self.current else 0) box.addWidget(button) self.buttons.append(button) btnBox = Qt.QDialogButtonBox(Qt.QDialogButtonBox.Ok | Qt.QDialogButtonBox.Cancel) btnBox.accepted.connect(self.accept) btnBox.rejected.connect(self.reject) box.addWidget(btnBox) self.show()
def init_ui(self): layout = Qt.QHBoxLayout() self.__current_password_input = Qt.QLineEdit("") self.__current_password_input.textChanged.connect( self.verify_current_password) self.__current_password_input.textChanged.connect( self.update_ok_button) lbl_current = Qt.QLabel(u"&Current password:"******"") self.__new_password_input.textChanged.connect(self.verify_new_password) self.__new_password_input.textChanged.connect(self.update_ok_button) lbl_new = Qt.QLabel(u"&New password:"******"") self.__verify_password_input.textChanged.connect( self.verify_new_password) self.__verify_password_input.textChanged.connect(self.update_ok_button) lbl_verify = Qt.QLabel(u"&Verify password:") lbl_verify.setBuddy(self.__verify_password_input) grid_layout = Qt.QGridLayout() grid_layout.addWidget(lbl_current, 0, 0) grid_layout.addWidget(self.__current_password_input, 0, 1) grid_layout.addWidget(lbl_new, 1, 0) grid_layout.addWidget(self.__new_password_input, 1, 1) grid_layout.addWidget(lbl_verify, 2, 0) grid_layout.addWidget(self.__verify_password_input, 2, 1) self.__ok_cancel = Qt.QDialogButtonBox(Qt.QDialogButtonBox.Ok | Qt.QDialogButtonBox.Cancel) self.__ok_cancel.setOrientation(Qt.Qt.Vertical) self.__ok_cancel.accepted.connect(self.accept) self.__ok_cancel.rejected.connect(self.reject) layout.addLayout(grid_layout) layout.addWidget(self.__ok_cancel) self.setLayout(layout)
def __init__(self, parent, availableAddons): super(AddAddonDlg, self).__init__(parent) box = Qt.QVBoxLayout(self) box.addWidget(Qt.QLabel(self.tr("Donnez le nom ou l'URL de l'addon que vous souhaitez ajouter :"), self)) self.input = Qt.QLineEdit(self) box.addWidget(self.input) btnBox = Qt.QDialogButtonBox(Qt.QDialogButtonBox.Ok | Qt.QDialogButtonBox.Cancel) btnBox.accepted.connect(self.accept) btnBox.rejected.connect(self.reject) box.addWidget(btnBox) self.show() if availableAddons: self.completer = Qt.QCompleter([addon[0] for addon in availableAddons], self) self.completer.setFilterMode(Qt.Qt.MatchContains) self.completer.setCaseSensitivity(Qt.Qt.CaseInsensitive) self.input.setCompleter(self.completer) else: Qt.QMessageBox.information(self, self.tr("Catalogue des addons absent"), self.tr( "Vous n'avez pas mis à jour le catalogue des addons disponibles, " "donnez l'URL de l'addon que vous souhaitez ajouter."))
def __init__(self, devices, parent=None): super().__init__(parent) self.setModal(True) self.setWindowModality(Qt.Qt.WindowModal) self.setWindowTitle('Select Game Controller') self.setSizeGripEnabled(True) self.resize(865, 400) self.button_box = Qt.QDialogButtonBox( Qt.QDialogButtonBox.Ok | Qt.QDialogButtonBox.Cancel, Qt.Qt.Horizontal) self.button_box.accepted.connect(self.accept) self.button_box.rejected.connect(self.reject) self.connect_button = self.button_box.button(Qt.QDialogButtonBox.Ok) self.connect_button.setText('Connect') l = Qt.QVBoxLayout() self.setLayout(l) self.table_widget = Qt.QTableWidget() self.table_widget.setEditTriggers(Qt.QAbstractItemView.NoEditTriggers) self.table_widget.setSelectionMode( Qt.QAbstractItemView.SingleSelection) self.table_widget.setSelectionBehavior(Qt.QAbstractItemView.SelectRows) self.table_widget.setDragDropMode(Qt.QAbstractItemView.NoDragDrop) self.table_widget.setColumnCount(2) self.table_widget.setHorizontalHeaderItem(0, Qt.QTableWidgetItem('Type')) self.table_widget.setHorizontalHeaderItem(1, Qt.QTableWidgetItem('Name')) l.addWidget(self.table_widget) l.addWidget(self.button_box) sm = self.table_widget.selectionModel() sm.currentRowChanged.connect(self.on_table_widget_current_row_changed) self.selected_row = None self.table_widget.setRowCount(len(self.devices)) sm.clear() for i, (device_type, device_name) in enumerate(devices): self.table_widget.setItem(i, 0, Qt.QTableWidgetItem(device_type)) self.table_widget.setItem(i, 1, Qt.QTableWidgetItem(device_name)) if self.device_rows: self.table_widget.resizeColumnsToContents() sm.select(sm.model().index(0, 0), sm.Rows | sm.Current | sm.Select)
def __init__(self, parent=None, modal=True): """ Create dialog. Arguments: parent (Optional[QWidget]): Parent widget. Defaults to *None*. modal (Optional[bool]): Dialog's modality: *True* for modal dialog; *False* for modeless one. Defaults to *True*. """ super(Dialog, self).__init__(parent) self.setModal(modal) self._buttons = {} self._frame = Q.QWidget(self) self._frame.setObjectName("Dialog_frame") self._tab = Q.QTabWidget(self._frame) self._tab.setObjectName("Dialog_tab") self._main = Q.QWidget(self) self._main.setObjectName("Dialog_main") self._buttonbox = Q.QDialogButtonBox(Q.Qt.Horizontal, self) buttons = Q.QDialogButtonBox.Ok | Q.QDialogButtonBox.Cancel self.setStandardButtons(buttons) v_layout = Q.QVBoxLayout(self._frame) v_layout.setContentsMargins(0, 0, 0, 0) v_layout.addWidget(self._tab) v_layout.addWidget(self._main) v_layout = Q.QVBoxLayout(self) v_layout.addWidget(self._frame) v_layout.addWidget(self._buttonbox) self._tab.hide() self.okButton().clicked.connect(self.accept) self.cancelButton().clicked.connect(self.reject)