Python PyQt5.QtWidgets.QWidget.__init__() Examples
The following are 30
code examples of PyQt5.QtWidgets.QWidget.__init__().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtWidgets.QWidget
, or try the search function
.
Example #1
Source File: hexteditor.py From guppy-proxy with MIT License | 8 votes |
def __init__(self, *args, **kwargs): QWidget.__init__(self, *args, **kwargs) self.headers = Headers() self.data = b'' self.view = 0 self.setLayout(QVBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.stack = QStackedLayout() self.stack.setContentsMargins(0, 0, 0, 0) self.nopp_widg = QLabel("No pretty version available") self.stack.addWidget(self.nopp_widg) self.highlighted_widg = QTextEdit() self.highlighted_widg.setReadOnly(True) self.stack.addWidget(self.highlighted_widg) self.json_widg = QTextEdit() self.json_widg.setReadOnly(True) self.stack.addWidget(self.json_widg) self.htmlxml_widg = QTextEdit() self.htmlxml_widg.setReadOnly(True) self.stack.addWidget(self.htmlxml_widg) self.selector = QComboBox() self.selector.addItem("Manually Select Printer", self.VIEW_NONE) self.selector.addItem("Highlighted", self.VIEW_HIGHLIGHTED) self.selector.addItem("JSON", self.VIEW_JSON) self.selector.addItem("HTML/XML", self.VIEW_HTMLXML) self.selector.currentIndexChanged.connect(self._combo_changed) self.layout().addWidget(self.selector) self.layout().addLayout(self.stack)
Example #2
Source File: reqlist.py From guppy-proxy with MIT License | 7 votes |
def __init__(self, *args, **kwargs): QWidget.__init__(self, *args, **kwargs) layout = QHBoxLayout() confirm = QToolButton() confirm.setText("OK") confirm.setToolTip("Apply the entered filter") self.field_entry = get_field_entry() # stack containing widgets for string, k/v, date, daterange self.str_cmp_entry = StringCmpWidget() self.kv_cmp_entry = StringKVWidget() self.inv_entry = QCheckBox("inv") # date # daterange self.entry_layout = QStackedLayout() self.entry_layout.setContentsMargins(0, 0, 0, 0) self.current_entry = 0 self.entry_layout.addWidget(self.str_cmp_entry) self.entry_layout.addWidget(self.kv_cmp_entry) # add date # 2 # add daterange # 3 confirm.clicked.connect(self.confirm_entry) self.str_cmp_entry.returnPressed.connect(self.confirm_entry) self.kv_cmp_entry.returnPressed.connect(self.confirm_entry) self.field_entry.currentIndexChanged.connect(self._display_value_widget) layout.addWidget(confirm) layout.addWidget(self.inv_entry) layout.addWidget(self.field_entry) layout.addLayout(self.entry_layout) self.setLayout(layout) self.setContentsMargins(0, 0, 0, 0) self._display_value_widget()
Example #3
Source File: WMachineTable.py From pyleecan with Apache License 2.0 | 6 votes |
def __init__(self, parent=None): """Initialize the GUI Parameters ---------- self : SWindCond A SWindCond widget """ # Build the interface according to the .ui file QWidget.__init__(self, parent) self.setupUi(self) self.machine = None # Connect the widget self.b_mmf.clicked.connect(self.plot_mmf)
Example #4
Source File: WBarOut.py From pyleecan with Apache License 2.0 | 6 votes |
def __init__(self, parent=None): """Initialize the widget """ # Main widget setup QWidget.__init__(self, parent) self.u = gui_option.unit self.setTitle(self.tr("Output")) self.setMinimumSize(QSize(200, 0)) self.setObjectName("g_output") self.layout = QVBoxLayout(self) self.layout.setObjectName("layout") # The widget is composed of 3 QLabel in a vertical layout self.out_Sbar = QLabel(self) self.out_Sbar.setObjectName("out_Sbar") self.layout.addWidget(self.out_Sbar) self.out_Sslot = QLabel(self) self.out_Sslot.setObjectName("out_Sslot") self.layout.addWidget(self.out_Sslot) self.out_ratio = QLabel(self) self.out_ratio.setMinimumSize(QSize(140, 0)) self.out_ratio.setObjectName("out_ratio") self.layout.addWidget(self.out_ratio)
Example #5
Source File: decoder.py From guppy-proxy with MIT License | 6 votes |
def __init__(self, *args, **kwargs): QWidget.__init__(self) layout = QVBoxLayout() tool_layout = QHBoxLayout() self.editor = ComboEditor(pretty_tab=False, enable_pretty=False) self.encode_entry = QComboBox() encode_button = QPushButton("Go!") encode_button.clicked.connect(self.encode) for k, v in self.decoders.items(): self.encode_entry.addItem(v[0], k) layout.addWidget(self.editor) tool_layout.addWidget(self.encode_entry) tool_layout.addWidget(encode_button) tool_layout.addStretch() layout.addLayout(tool_layout) self.setLayout(layout) self.layout().setContentsMargins(0, 0, 0, 0)
Example #6
Source File: macros.py From guppy-proxy with MIT License | 6 votes |
def __init__(self, client, *args, **kwargs): self.client = client QWidget.__init__(self, *args, **kwargs) self.setLayout(QVBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.tab_widg = QTabWidget() self.active_widg = ActiveMacroWidget(client) self.active_ind = self.tab_widg.count() self.tab_widg.addTab(self.active_widg, "Active") self.int_widg = IntMacroWidget(client) self.int_ind = self.tab_widg.count() self.tab_widg.addTab(self.int_widg, "Intercepting") self.warning_widg = QLabel("<h1>Warning! Macros may cause instability</h1><p>Macros load and run python files into the Guppy process. If you're not careful when you write them you may cause Guppy to crash. If an active macro ends up in an infinite loop you may need to force kill the application when you quit.</p><p><b>PROCEED WITH CAUTION</b></p>") self.warning_widg.setWordWrap(True) self.tab_widg.addTab(self.warning_widg, "Warning") self.layout().addWidget(self.tab_widg)
Example #7
Source File: reqlist.py From guppy-proxy with MIT License | 6 votes |
def __init__(self, *args, **kwargs): QWidget.__init__(self, *args, **kwargs) self.str2_shown = False self.str1 = StringCmpWidget() self.str2 = StringCmpWidget() self.str1.returnPressed.connect(self.returnPressed) self.str2.returnPressed.connect(self.returnPressed) self.toggle_button = QToolButton() self.toggle_button.setText("+") self.toggle_button.clicked.connect(self._show_hide_str2) layout = QHBoxLayout() layout.addWidget(self.str1) layout.addWidget(self.str2) layout.addWidget(self.toggle_button) self.str2.setVisible(self.str2_shown) self.setLayout(layout) self.layout().setContentsMargins(0, 0, 0, 0)
Example #8
Source File: reqlist.py From guppy-proxy with MIT License | 6 votes |
def __init__(self, *args, **kwargs): QWidget.__init__(self, *args, **kwargs) self.current_entry = 0 self.max_entries = 2 self.text_entry = TextFilterEntry() dropdown_entry = DropdownFilterEntry() self.text_entry.filterEntered.connect(self.filterEntered) dropdown_entry.filterEntered.connect(self.filterEntered) self.entry_layout = QStackedLayout() self.entry_layout.addWidget(dropdown_entry) self.entry_layout.addWidget(self.text_entry) swap_button = QToolButton() swap_button.setText(">") swap_button.setToolTip("Switch between dropdown and text entry") swap_button.clicked.connect(self.next_entry) hlayout = QHBoxLayout() hlayout.addWidget(swap_button) hlayout.addLayout(self.entry_layout) self.setLayout(hlayout) self.layout().setContentsMargins(0, 0, 0, 0) self.layout().setSpacing(0)
Example #9
Source File: hexteditor.py From guppy-proxy with MIT License | 6 votes |
def __init__(self, enable_pretty=True): QWidget.__init__(self) layout = QVBoxLayout() self.enable_pretty = enable_pretty self.setLayout(layout) self.layout().setSpacing(0) self.layout().setContentsMargins(0, 0, 0, 0) self.lexer = TextLexer() self.textedit = QTextEdit() self.textedit.setAcceptRichText(False) doc = self.textedit.document() font = doc.defaultFont() font.setFamily("Courier New") font.setPointSize(10) doc.setDefaultFont(font) doc.addResource(QTextDocument.ImageResource, QUrl(self.byte_url), HextEditor.byte_image) self.textedit.focusInEvent = self.focus_in_event self.textedit.focusOutEvent = self.focus_left_event self.data = b'' self.pretty_mode = False self.layout().addWidget(self.textedit)
Example #10
Source File: mode.py From Anki-Night-Mode with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent, initial_time, label, on_update=lambda x: x): """ Args: parent: ColorMapWindow instance """ QWidget.__init__(self, parent) self.parent = parent self.on_update = on_update self.label = QLabel(label) self.qt_time = QTime.fromString(initial_time) self.time_edit = QTimeEdit(self.qt_time) self.time_edit.timeChanged.connect(self.update) self.grid = QGridLayout() self.fill_layout() self.setLayout(self.grid)
Example #11
Source File: reqview.py From guppy-proxy with MIT License | 6 votes |
def __init__(self, *args, **kwargs): QWidget.__init__(self, *args, **kwargs) self.request = None self.setLayout(QVBoxLayout()) self.layout().setSpacing(0) self.layout().setContentsMargins(0, 0, 0, 0) self.infotable = QTableWidget() self.infotable.setColumnCount(2) self.infotable.verticalHeader().hide() self.infotable.horizontalHeader().hide() self.infotable.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeToContents) self.infotable.verticalHeader().setSectionResizeMode(QHeaderView.ResizeToContents) self.infotable.horizontalHeader().setStretchLastSection(True) self.layout().addWidget(self.infotable)
Example #12
Source File: reqview.py From guppy-proxy with MIT License | 6 votes |
def __init__(self, *args, **kwargs): QWidget.__init__(self, *args, **kwargs) self.request = None self.setLayout(QVBoxLayout()) self.tab_widget = QTabWidget() self.urltable = QTableWidget() self.urltable.setColumnCount(2) self.posttable = QTableWidget() self.posttable.setColumnCount(2) self.cookietable = QTableWidget() self.cookietable.setColumnCount(2) self.tab_widget.addTab(self.urltable, "URL") self.tab_widget.addTab(self.posttable, "POST") self.tab_widget.addTab(self.cookietable, "Cookies") self.format_table(self.urltable) self.format_table(self.posttable) self.format_table(self.cookietable) self.layout().addWidget(self.tab_widget)
Example #13
Source File: color_map.py From Anki-Night-Mode with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent, color=None, on_color_change=None, name='Color', verify_colors=False): """ Args: parent: a parent Qt instance color: the color name or hexadecimal code (in form of a string) on_color_change: a function or method taking old color and a new one verify_colors: should the parent be asked if the color is acceptable? to verify a color parent.is_acceptable(color) will be invoked """ QPushButton.__init__(self, color, parent) self.verify_colors = verify_colors self.parent = parent self.color = color self.name = name self.callback = on_color_change if color: self.set_color(color) else: self.setText(_('(Not specified)')) self.clicked.connect(self.pick_color)
Example #14
Source File: settings.py From guppy-proxy with MIT License | 5 votes |
def __init__(self, *args, **kwargs): QWidget.__init__(self, *args, **kwargs) self.setLayout(QVBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.listenerlist = ListenerList() self.listenerlist.listenersUpdated.connect(self.listenersUpdated) self.layout().addWidget(self.listenerlist) self.hostinput = QLineEdit() self.hostinput.setText("127.0.0.1") self.hostinput.returnPressed.connect(self.add_listener) self.portinput = QLineEdit() self.portinput.setMaxLength(5) self.portinput.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred) self.portinput.returnPressed.connect(self.add_listener) self.addbutton = QToolButton() self.addbutton.setText("+") self.removebutton = QToolButton() self.removebutton.setText("-") editbar = QHBoxLayout() editbar.addWidget(self.addbutton) editbar.addWidget(self.removebutton) editbar.addWidget(QLabel("Interface:")) editbar.addWidget(self.hostinput) editbar.addWidget(QLabel("Port:")) editbar.addWidget(self.portinput) self.removebutton.clicked.connect(self.listenerlist.delete_selected) self.addbutton.clicked.connect(self.add_listener) self.layout().addLayout(editbar)
Example #15
Source File: masternode_details.py From dash-masternode-tool with MIT License | 5 votes |
def __init__(self, main_dlg, app_config, dashd_intf): QWidget.__init__(self, main_dlg) ui_masternode_details.Ui_WdgMasternodeDetails.__init__(self) self.main_dlg = main_dlg self.app_config = app_config self.dashd_intf = dashd_intf self.masternode: MasternodeConfig = None self.updating_ui = False self.edit_mode = False self.setupUi()
Example #16
Source File: hexteditor.py From guppy-proxy with MIT License | 5 votes |
def __init__(self, pretty_tab=True, enable_pretty=True): QWidget.__init__(self) self.setLayout(QVBoxLayout()) self.layout().setSpacing(0) self.layout().setContentsMargins(0, 0, 0, 0) self.data = b'' self.enable_pretty = enable_pretty self.tabWidget = QTabWidget() self.hexteditor = HextEditor(enable_pretty=self.enable_pretty) self.hexeditor = HexEditor() self.ppwidg = PrettyPrintWidget() self.hexteditor_ind = self.tabWidget.count() self.tabWidget.addTab(self.hexteditor, "Text") self.hexeditor_ind = self.tabWidget.count() self.tabWidget.addTab(self.hexeditor, "Hex") self.pp_ind = -1 if pretty_tab: self.pp_ind = self.tabWidget.count() self.tabWidget.addTab(self.ppwidg, "Pretty") self.tabWidget.currentChanged.connect(self._tab_changed) self.previous_tab = self.tabWidget.currentIndex() self.layout().addWidget(self.tabWidget)
Example #17
Source File: reqview.py From guppy-proxy with MIT License | 5 votes |
def __init__(self, max_len=50000, *args, **kwargs): self.max_len = max_len Lexer.__init__(self, *args, **kwargs)
Example #18
Source File: reqview.py From guppy-proxy with MIT License | 5 votes |
def __init__(self, *args, **kwargs): QTableWidget.__init__(self, *args, **kwargs) self.tags = set() # Set up table self.setColumnCount(1) self.horizontalHeader().hide() self.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) self.verticalHeader().hide() self.verticalHeader().setSectionResizeMode(QHeaderView.ResizeToContents) self.setEditTriggers(QAbstractItemView.NoEditTriggers)
Example #19
Source File: settings.py From guppy-proxy with MIT License | 5 votes |
def __init__(self, *args, **kwargs): QTableWidget.__init__(self, *args, **kwargs) self.listeners = [] # Set up table self.setColumnCount(1) self.horizontalHeader().hide() self.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) self.verticalHeader().hide() self.verticalHeader().setSectionResizeMode(QHeaderView.ResizeToContents) self.setEditTriggers(QAbstractItemView.NoEditTriggers)
Example #20
Source File: macros.py From guppy-proxy with MIT License | 5 votes |
def __init__(self, *args, **kwargs): QObject.__init__(self, *args, **kwargs) self.msg = "" self.setLayout(QVBoxLayout()) self.msgwidg = QPlainTextEdit() self.layout().addWidget(self.msgwidg)
Example #21
Source File: macros.py From guppy-proxy with MIT License | 5 votes |
def __init__(self, parent, filename='', resultSlot=None): QObject.__init__(self) self.fname = filename or None # filename we load from self.source = None self.parent = parent self.cached_args = {} self.load()
Example #22
Source File: macros.py From guppy-proxy with MIT License | 5 votes |
def __init__(self, client): QObject.__init__(self) self._client = client
Example #23
Source File: about_dialog.py From robovision with GNU General Public License v3.0 | 5 votes |
def __init__(self): QWidget.__init__(self) # loaind ui from xml self.ui = uic.loadUi(os.path.join(DIRPATH, 'about_dialog.ui'), self) add_image_to_label(self.lblIcon, "./images/robot_icon_small.png") # keep the window fixed sized self.setFixedSize(self.size())
Example #24
Source File: loadf2.py From CNNArt with Apache License 2.0 | 5 votes |
def __init__(self, matplotlibwidget_static, chosenSSNumber): super(loadImage_subset_selection_plot, self).__init__() self.matplotlibwidget_static = matplotlibwidget_static self.chosenSSNumber=chosenSSNumber
Example #25
Source File: loadf2.py From CNNArt with Apache License 2.0 | 5 votes |
def __init__(self, matplotlibwidget_static, chosenPatchNumber,chosenPatchSliceNumber): super(loadImage_features_plot_3D, self).__init__() self.matplotlibwidget_static = matplotlibwidget_static self.chosenPatchNumber =chosenPatchNumber self.chosenPatchSliceNumber=chosenPatchSliceNumber
Example #26
Source File: loadf2.py From CNNArt with Apache License 2.0 | 5 votes |
def __init__(self, matplotlibwidget_static,chosenPatchNumber): super(loadImage_features_plot, self).__init__() self.matplotlibwidget_static = matplotlibwidget_static self.chosenPatchNumber =chosenPatchNumber
Example #27
Source File: loadf2.py From CNNArt with Apache License 2.0 | 5 votes |
def __init__(self, matplotlibwidget_static, w,chosenWeightNumber,totalWeights,totalWeightsSlices): super(loadImage_weights_plot_3D, self).__init__() self.matplotlibwidget_static=matplotlibwidget_static self.w=w self.chosenWeightNumber=chosenWeightNumber self.totalWeights=totalWeights self.totalWeightsSlices=totalWeightsSlices
Example #28
Source File: loadf2.py From CNNArt with Apache License 2.0 | 5 votes |
def __init__(self, matplotlibwidget_static,chosenLayerName): super(loadImage_weights_plot_2D, self).__init__() self.matplotlibwidget_static=matplotlibwidget_static self.chosenLayerName = chosenLayerName
Example #29
Source File: pagination_widget.py From execution-trace-viewer with MIT License | 5 votes |
def __init__(self, parent=None): QWidget.__init__(self, parent=parent) self.rows_per_page = 1000 self.page_count = 1 self.current_page = 1 self.init_ui()
Example #30
Source File: color_map.py From Anki-Night-Mode with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent, color_map, title='Customise colors swapping', on_update=None): super().__init__(self, parent, Qt.Window) self.on_update = on_update self.color_map = color_map self.init_ui(title)