def __init__(self, parent=None): super(SplitterWidget, self).__init__(parent) self.setWindowTitle("Splitter") font = QFont(self.tr("黑体"), 12) QApplication.setFont(font) mainSplitter = QSplitter(Qt.Horizontal, self) leftText = QTextEdit(self.tr("左窗口"), mainSplitter) leftText.setAlignment(Qt.AlignCenter) rightSplitter = QSplitter(Qt.Vertical, mainSplitter) rightSplitter.setOpaqueResize(False) upText = QTextEdit(self.tr("上窗口"), rightSplitter) upText.setAlignment(Qt.AlignCenter) bottomText = QTextEdit(self.tr("下窗口"), rightSplitter) bottomText.setAlignment(Qt.AlignCenter) mainSplitter.setStretchFactor(1, 1) mainSplitter.setWindowTitle(self.tr("分割窗口")) self.setCentralWidget(mainSplitter)
def setupUi(self): self.mainlayout = QVBoxLayout(self) self.title = QLabel("CardBord Operator", self) self.mainlayout.addWidget(self.title) self.user_txtarea = QTextEdit(self) self.ai_txtarea = QTextEdit(self) self.users_edit_title = QLabel("質問に答えてください") self.users_edit = QLineEdit("", self) self.txtarea_layout = QHBoxLayout() self.txtarea_layout.addWidget(self.user_txtarea) self.txtarea_layout.addWidget(self.ai_txtarea) self.mainlayout.addLayout(self.txtarea_layout) self.mainlayout.addWidget(self.users_edit_title) self.mainlayout.addWidget(self.users_edit) self.send_btn = QPushButton("send", self) self.send_btn.setObjectName("send_btn") self.mainlayout.addWidget(self.send_btn) QMetaObject.connectSlotsByName(self)
def __init__(self, parent=None): super(LoggingArea, self).__init__() self.layout = QVBoxLayout(self) self.hbox_buttons_top = QHBoxLayout(self) self.button_start = QPushButton('Start Logging', self) self.button_start.clicked.connect(parent._start_logging) self.hbox_buttons_top.addWidget(self.button_start) self.button_stop = QPushButton('Stop Logging', self) self.button_stop.clicked.connect(parent._stop_logging) self.hbox_buttons_top.addWidget(self.button_stop) self.layout.addLayout(self.hbox_buttons_top) self.te_logging = QTextEdit(self) self.layout.addWidget(self.te_logging) self.hbox_buttons_bottom = QHBoxLayout(self) self.button_clear = QPushButton('Clear Data', self) self.button_clear.clicked.connect(self._clear_data) self.hbox_buttons_bottom.addWidget(self.button_clear) self.button_clipboard = QPushButton('Copy to Clipboard', self) self.button_clipboard.clicked.connect(self._copy_to_cliboard) self.hbox_buttons_bottom.addWidget(self.button_clipboard) self.button_file = QPushButton('Save to CSV', self) self.button_file.clicked.connect(self._save_to_csv) self.button_file.setEnabled(False) self.hbox_buttons_bottom.addWidget(self.button_file) self.layout.addLayout(self.hbox_buttons_bottom) self.setLayout(self.layout)
def __init__(self): super(MainWindow, self).__init__() # Store ourself. self.windows.append(self) # State! self.current_file = None # Editor! self.editor = QTextEdit() self.setCentralWidget(self.editor) # Style the editor #style.apply_stylesheet(self.editor, 'editor.qss') # Menus and Stuff! self.init_actions() self.init_menus() self.init_toolbars() self.init_statusbar() # Settings! self.init_settings() # Icons! self.reload_icons() #style.style_reloaded.connect(self.reload_icons) # Fancy! #style.enable_aero(self) self.update_title()
def __init__(self, parent=None): super(AddDialogWidget, self).__init__(parent) nameLabel = QLabel("Name") addressLabel = QLabel("Address") buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.nameText = QLineEdit() self.addressText = QTextEdit() grid = QGridLayout() grid.setColumnStretch(1, 2) grid.addWidget(nameLabel, 0, 0) grid.addWidget(self.nameText, 0, 1) grid.addWidget(addressLabel, 1, 0, Qt.AlignLeft | Qt.AlignTop) grid.addWidget(self.addressText, 1, 1, Qt.AlignLeft) layout = QVBoxLayout() layout.addLayout(grid) layout.addWidget(buttonBox) self.setLayout(layout) self.setWindowTitle("Add a Contact") buttonBox.accepted.connect(self.accept) buttonBox.rejected.connect(self.reject)
def __init__(self): super(TwoStepLandmarkWidget, self).__init__() self.textFrame = QTextEdit( "<p>Place your mouse over the desired " "landmark point. Press 'Space' to shoot a ray through the volume. " "Move the volume around and move the mouse to move the locator. " "Press 'Space' again to define the final place of the landmark.</p>" "<p>You can also use the ray profile to define the landmark's location.</p>" ) self.textFrame.setReadOnly(True) self.textFrame.setFrameShape(QFrame.NoFrame) self.textFrame.setAutoFillBackground(False) self.textFrame.setAttribute(Qt.WA_TranslucentBackground) self.textFrame.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.textFrame.setStyleSheet("background: #aaa") self.histogramWidget = TrackingHistogramWidget() self.histogramWidget.setMinimumHeight(100) self.histogramWidget.setVisible(False) self.button = QPushButton("Pick current landmark position") self.button.clicked.connect(self.applyButtonClicked) self.button.setVisible(False) layout = QGridLayout() layout.setAlignment(Qt.AlignTop) layout.setSpacing(0) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self.textFrame) layout.addWidget(self.histogramWidget) layout.addWidget(self.button) self.setLayout(layout)
def __init__(self, parent, change_tracker: ChangeTracker): super(CommentsWidget, self).__init__(parent) self._change_tracker = change_tracker #self.setObjectName("zwhite") layout = QVBoxLayout() self.comments_list_widget = QFrame( self ) # If you use QWidget, the background won't be set; don't know why :-( self.comments_list_widget.setStyleSheet("background: white;") self.comments_list_widget.setAutoFillBackground(True) #self.comments_list_widget.setObjectName("zwhite") self._comments_layout = QVBoxLayout() self.comments_list_widget.setLayout(self._comments_layout) self.comments_list_widget.hide() self.text_edit = QTextEdit(self) self.submit_button = QPushButton(("Add"), self) layout.addWidget(self.comments_list_widget) layout.addWidget(self.text_edit) hlayout = QHBoxLayout() hlayout.addStretch() hlayout.addWidget(self.submit_button) layout.addLayout(hlayout) self.setLayout(layout) self.submit_button.clicked.connect(self.submit_comment)
def Layout(self): #LAYOUT self.directory_prompt = QLabel(self) self.directory_prompt.setText("Directory Selected:") self.directory_prompt.move(25, 50) self.directory_prompt.resize(150, 30) self.directory_prompt.setVisible(False) self.browse_btn = QPushButton("Browse", self) self.browse_btn.move(130, 50) self.browse_btn.resize(50, 30) self.browse_btn.setStatusTip(" Browse Folder") # self.browse_btn.setStyleSheet("background-color: rgb(186, 186, 186); border-radius: 15px;border-style: solid;border-width: 2px;border-color: black;"); self.browse_btn.clicked.connect(self.browse) self.dir_shower = QLabel(self) self.dir_shower.setText("") self.dir_shower.setVisible(False) self.label_version = QLabel(self) self.label_version.setText("Version to rename") self.label_version.setVisible(False) self.version = QTextEdit() self.version.setStatusTip("Version to rename example: 1_6") self.version.setFixedHeight(30) self.version.setFixedWidth(40) self.version.setVisible(False) self.run_mars = QPushButton("RENAME", self) self.run_mars.setVisible(False) self.run_mars.move(50, 200) self.run_mars.resize(self.screen_w / 2 - 150, 50) self.run_mars.setStatusTip('') self.run_mars.setStyleSheet( "background-color: rgb(142, 229, 171); border-radius: 15px;") self.run_mars.clicked.connect(self.run_event) self.menu_layout = QtGui.QHBoxLayout() self.menu_layout.addWidget(self.browse_btn) self.menu_layout.addWidget(self.directory_prompt) self.menu_layout.addWidget(self.dir_shower) self.menu_layout.addStretch() self.version_layout = QtGui.QHBoxLayout() self.version_layout.addWidget(self.label_version) self.version_layout.addWidget(self.version) self.version_layout.addStretch() self.run_layout = QtGui.QHBoxLayout() self.run_layout.addWidget(self.run_mars) self.main_layout = QtGui.QVBoxLayout() self.main_layout.addLayout(self.menu_layout) self.main_layout.addLayout(self.version_layout) self.main_layout.addLayout(self.run_layout) self.main_layout.addStretch()
def SetupComponents(self): """ Function to setup status bar, central widget, menu bar """ self.myStatusBar = QStatusBar() self.setStatusBar(self.myStatusBar) self.myStatusBar.showMessage('Ready', 10000) self.textEdit = QTextEdit() self.setCentralWidget(self.textEdit) # self.CreateActions() # self.CreateMenus() # self.fileMenu.addAction(self.newAction) # self.fileMenu.addSeparator() # self.fileMenu.addAction(self.exitAction) # self.editMenu.addAction(self.copyAction) # self.fileMenu.addSeparator() # self.editMenu.addAction(self.pasteAction) # self.helpMenu.addAction(self.aboutAction) self.myStatusBar = QStatusBar() self.setStatusBar(self.myStatusBar) self.myStatusBar.showMessage('Ready', 10000) self.CreateActions() self.CreateMenus() self.CreateToolBar() self.fileMenu.addAction(self.newAction) self.fileMenu.addAction(self.openAction) self.fileMenu.addAction(self.saveAction) self.fileMenu.addSeparator() self.fileMenu.addAction(self.exitAction) self.editMenu.addAction(self.cutAction) self.editMenu.addAction(self.copyAction) self.editMenu.addAction(self.pasteAction) self.editMenu.addSeparator() self.editMenu.addAction(self.undoAction) self.editMenu.addAction(self.redoAction) self.editMenu.addAction(self.ss_image) self.editMenu.addSeparator() self.editMenu.addAction(self.selectAllAction) self.formatMenu.addAction(self.fontAction) self.helpMenu.addAction(self.aboutAction) self.helpMenu.addSeparator() self.helpMenu.addAction(self.aboutQtAction) self.mainToolBar.addAction(self.newAction) self.mainToolBar.addAction(self.openAction) self.mainToolBar.addAction(self.saveAction) self.mainToolBar.addSeparator() self.mainToolBar.addAction(self.cutAction) self.mainToolBar.addAction(self.copyAction) self.mainToolBar.addAction(self.pasteAction) self.mainToolBar.addSeparator() self.mainToolBar.addAction(self.undoAction) self.mainToolBar.addAction(self.redoAction)
def __init__(self, variable_setting, parent=None): super(FoamDictWidget, self).__init__(parent) self.buttonLayout = QHBoxLayout() self.pushButtonInsert = QPushButton("Add new row") self.pushButtonRemove = QPushButton("Del selected row") self.pushButtonRestore = QPushButton("Restore table") self.pushButtonClear = QPushButton("Clear table") self.buttonLayout.addWidget(self.pushButtonInsert) self.buttonLayout.addWidget(self.pushButtonRemove) self.buttonLayout.addWidget(self.pushButtonRestore) self.buttonLayout.addWidget(self.pushButtonClear) self.tableWidget = QTableWidget() # header, should not sort, has vertical scrollbar # set column count, fixed to 2, size of TableItem self.tableWidget.setColumnCount(2) # self.tableWidget.setHorizontalHeaderItem(0, ) self.tableWidget.setHorizontalHeaderLabels(['key', 'value text']) # set a default row count, insert as needed self.tableWidget.setRowCount(0) self.buttonPreview = QPushButton('Preview FoamFile write-out') # self.buttonLoad = QPushButton('load dict from existing case ') self.buttonCustomize = QPushButton('Customize (convert into raw)') self.textPreview = QTextEdit('') self.textPreview.setVisible(False) self.textPreview.setEnabled(False) #PySide has different name other than @QtCore.pyqtSlot, but PySide.QtCore.SLOT #PySide has different name other than @QtCore.pyqtSlot, but PySide.QtCore.SLOT self.pushButtonInsert.clicked.connect(self.insertRow) self.pushButtonRemove.clicked.connect(self.removeRow) self.pushButtonRestore.clicked.connect(self.restoreDict) self.pushButtonClear.clicked.connect(self.clearDict) # self.tableWidget.doubleClicked.connect( self.showPreview) # does not work for PySide self.buttonPreview.clicked.connect(self.showPreview) self.buttonCustomize.clicked.connect(self.customizeDict) self._previewing = False self.settings = variable_setting self.previous_settings = self.settings #self.restoreDict() self.updateDictView(self.settings) self.myLayout = QVBoxLayout() self.myLayout.addLayout(self.buttonLayout) self.myLayout.addWidget(self.tableWidget) self.myLayout.addWidget(self.buttonPreview) self.myLayout.addWidget(self.textPreview) self.setLayout(self.myLayout)
def __init__(self): super(MyWidget3, self).__init__() vbox = QVBoxLayout() btnIzaberiIzvestaj = QPushButton("Izaberi izvestaj") textEdit = QTextEdit() vbox.addWidget(btnIzaberiIzvestaj) vbox.addWidget(textEdit) self.setLayout(vbox)
def testIt(self): self.textEdit = QTextEdit() self.textEdit.show() interface = Foo() self.textEdit.document().documentLayout().registerHandler(QAbstractTextDocumentLayoutTest.objectType, interface) QTimer.singleShot(0, self.foo) self.app.exec_() self.assertTrue(Foo.called)
def _createOutputWindow(self): """ Some binary analysis commands will output to this. """ self.output_label = QtGui.QLabel('Output') self.output_window = QTextEdit() self.output_window.setFontPointSize(10) self.output_window.setReadOnly(True) # Save it for later use self.output_window.original_textcolor = self.output_window.textColor()
def __init__(self, stream=None): QtGui.QDialog.__init__(self) self.stream = stream self.setWindowTitle('Console Messages') self.layout = QHBoxLayout(self) self.layout.setSpacing(6) self.layout.setContentsMargins(3, 3, 3, 3) self.edit = QTextEdit(self) self.edit.setReadOnly(True) self.layout.addWidget(self.edit) self.resize(450, 250)
def __init__(self, *args, **kwargs): super(Widget_textEdit_splitter, self).__init__(*args, **kwargs) self.installEventFilter(self) mainLayout = QVBoxLayout(self) w_convertButton = QWidget() lay_convertButton = QHBoxLayout(w_convertButton) label_orig = QLabel("Original") label_orig.setAlignment(QtCore.Qt.AlignCenter) label_convert = QLabel("Converted") label_convert.setAlignment(QtCore.Qt.AlignCenter) button = QPushButton(" >> ") lay_convertButton.addWidget(label_orig) lay_convertButton.addWidget(button) lay_convertButton.addWidget(label_convert) w_convertButton.setStyleSheet("font-size:13px") sizePolicy = QSizePolicy() sizePolicy.setVerticalPolicy(QSizePolicy.Fixed) sizePolicy.setHorizontalPolicy(QSizePolicy.Expanding) w_convertButton.setSizePolicy(sizePolicy) splitter = QSplitter() splitter.setStretchFactor(1, 1) textEdit_left = QTextEdit() textEdit_right = QTextEdit() splitter.addWidget(textEdit_left) splitter.addWidget(textEdit_right) textEdit_left.setLineWrapMode(QTextEdit.NoWrap) textEdit_right.setLineWrapMode(QTextEdit.NoWrap) mainLayout.addWidget(w_convertButton) mainLayout.addWidget(splitter) self.textEdit_left = textEdit_left self.textEdit_right = textEdit_right button.clicked.connect(self.load_convertedText)
def __init__(self, parent=None, format=settings.log_fmt, level=logging.INFO): logging.Handler.__init__(self) # Initialize a log handler as the super class self.setFormatter(logging.Formatter(format)) # Set the formatter for the logger self.setLevel(level) # Set the logging level self.frame = QFrame(parent) # Initialize a QFrame to place other widgets in self.frame2 = QFrame(parent) # Initialize frame2 for the label and checkbox self.label = QLabel('Logs') # Define a label for the frame self.check = QCheckBox('Debugging') # Checkbox to enable debugging logging self.check.clicked.connect(self.__changeLevel) # Connect checkbox clicked to the __changeLevel method self.log_widget = QTextEdit() # Initialize a QPlainTextWidget to write logs to self.log_widget.verticalScrollBar().minimum() # Set a vertical scroll bar on the log widget self.log_widget.horizontalScrollBar().minimum() # Set a horizontal scroll bar on the log widget self.log_widget.setLineWrapMode(self.log_widget.NoWrap) # Set line wrap mode to no wrapping self.log_widget.setFont(QFont("Courier", 12)) # Set the font to a monospaced font self.log_widget.setReadOnly(True) # Set log widget to read only layout = QHBoxLayout() # Initialize a horizontal layout scheme for the label and checkbox frame layout.addWidget(self.label) # Add the label to the layout scheme layout.addWidget(self.check) # Add the checkbox to the layout scheme self.frame2.setLayout(layout) # Set the layout for frame to the horizontal layout layout = QVBoxLayout() # Initialize a layout scheme for the widgets layout.addWidget(self.frame2) # Add the label/checkbox frame to the layout scheme layout.addWidget(self.log_widget) # Add the text widget to the layout scheme self.frame.setLayout(layout)
def __init__(self, parent=None): super(MainWindow, self).__init__(parent) # self.setObjectName("MainWindow") self.resize(731, 475) centralwidget = QWidget(self) # centralwidget.setObjectName("centralwidget") gridLayout = QGridLayout(centralwidget) # gridLayout.setObjectName("gridLayout") # textEdit needs to be a class variable. self.textEdit = QTextEdit(centralwidget) # self.textEdit.setObjectName("textEdit") gridLayout.addWidget(self.textEdit, 0, 0, 1, 1) self.setCentralWidget(centralwidget) menubar = QMenuBar(self) menubar.setGeometry(QRect(0, 0, 731, 29)) # menubar.setObjectName("menubar") menu_File = QMenu(menubar) # menu_File.setObjectName("menu_File") self.setMenuBar(menubar) statusbar = QStatusBar(self) # statusbar.setObjectName("statusbar") self.setStatusBar(statusbar) actionShow_GPL = QAction(self) # actionShow_GPL.setObjectName("actionShow_GPL") actionShow_GPL.triggered.connect(self.showGPL) action_About = QAction(self) # action_About.setObjectName("action_About") action_About.triggered.connect(self.about) iconToolBar = self.addToolBar("iconBar.png") #------------------------------------------------------ # Add icons to appear in tool bar - step 1 actionShow_GPL.setIcon(QIcon(":/showgpl.png")) action_About.setIcon(QIcon(":/about.png")) action_Close = QAction(self) action_Close.setCheckable(False) action_Close.setObjectName("action_Close") action_Close.setIcon(QIcon(":/quit.png")) #------------------------------------------------------ # Show a tip on the Status Bar - step 2 actionShow_GPL.setStatusTip("Show GPL Licence") action_About.setStatusTip("Pop up the About dialog.") action_Close.setStatusTip("Close the program.") #------------------------------------------------------ menu_File.addAction(actionShow_GPL) menu_File.addAction(action_About) menu_File.addAction(action_Close) menubar.addAction(menu_File.menuAction()) iconToolBar.addAction(actionShow_GPL) iconToolBar.addAction(action_About) iconToolBar.addAction(action_Close) action_Close.triggered.connect(self.close)
def __init__(self): BaseDock.__init__(self, 100) self.ttt = QTextEdit() self.setWidget(self.ttt) tt = QStyleOptionDockWidget() tt.closable = False tt.title = "OMG" self.initStyleOption(tt) self.setFeatures(QDockWidget.DockWidgetClosable)
def _make_supply_order_detail_view(self): # There's a self.proto somewhere, don't mess with it :-) # proto = [] # proto.append( TextLinePrototype('description',_('Description'), editable=True,nullable=False)) # proto.append( FloatNumberPrototype('quantity',_('Quantity'), editable=True,nullable=False)) # proto.append( FloatNumberPrototype('unit_price',_('Unit price'), editable=True,nullable=False)) # self.detail_model = PrototypedModelView(proto, self) # self.detail_view = PrototypedQuickView(proto, self) # self.detail_view.setModel(self.detail_model) # self.detail_view.verticalHeader().hide() self.detail_description = QTextEdit() self.detail_description.setTextInteractionFlags( Qt.TextBrowserInteraction) self.delivery_date_widget = QLabel() self.creation_date_widget = QLabel() self.supplier_reference_widget = QLabel() hlayout = QHBoxLayout() hlayout.addWidget(QLabel(_("Delivery date"))) hlayout.addWidget(self.delivery_date_widget) hlayout.addStretch() hlayout3 = QHBoxLayout() hlayout3.addWidget(QLabel(_("Creation date"))) hlayout3.addWidget(self.creation_date_widget) hlayout3.addStretch() hlayout2 = QHBoxLayout() hlayout2.addWidget(QLabel(_("Supplier's reference"))) hlayout2.addWidget(self.supplier_reference_widget) hlayout2.addStretch() layout = QVBoxLayout() layout.addLayout(hlayout) layout.addLayout(hlayout3) layout.addLayout(hlayout2) layout.addWidget(self.detail_description) layout.addStretch() # layout.addWidget(self.detail_view) # layout.setStretch(0,1) # layout.setStretch(1,3) return layout
def __init__(self, parent): super(PrintPreorderDialog, self).__init__(parent) title = _("Print preorder") self.setWindowTitle(title) top_layout = QVBoxLayout() self.title_widget = TitleWidget(title, self) top_layout.addWidget(self.title_widget) info = QLabel( _("Here you can give a small message that will be printed togetehr with the preorder." ), self) info.setWordWrap(True) top_layout.addWidget(info) top_layout.addWidget(QLabel(_("Header text"))) self.message_text_area = QTextEdit() top_layout.addWidget(self.message_text_area) top_layout.addWidget(QLabel(_("Footer text"))) self.message_text_area_footer = QTextEdit() top_layout.addWidget(self.message_text_area_footer) self.buttons = QDialogButtonBox() self.buttons.addButton(QDialogButtonBox.StandardButton.Cancel) self.buttons.addButton(QDialogButtonBox.Ok) top_layout.addWidget(self.buttons) self.setLayout(top_layout) self.buttons.accepted.connect(self.accept) self.buttons.rejected.connect(self.reject)
def initGUI(self): self.setWindowTitle("A Simple Text Editor") self.setWindowIcon(QIcon('appicon.png')) self.setGeometry(100, 100, 800, 600) self.center() # Text Editor self.textEdit = QTextEdit() self.setCentralWidget(self.textEdit) self.fileName = None self.filters = "Text files (*.txt)" # Setup and Show self.setupComponents() self.show()
def testRefcount(self): textedit = QTextEdit() textedit.setReadOnly(True) doc = textedit.document() cursor = QTextCursor(doc) cursor.insertText("PySide Rocks") ud = TestUserData({"Life": 42}) self.assertEqual(sys.getrefcount(ud), 2) cursor.block().setUserData(ud) self.assertEqual(sys.getrefcount(ud), 3) ud2 = cursor.block().userData() self.assertEqual(sys.getrefcount(ud), 4) self.udata = weakref.ref(ud, None) del ud, ud2 self.assertEqual(sys.getrefcount(self.udata()), 2)
def __init__(self, log, parent=None): super(EditConfigurationDialog, self).__init__(parent) layout = QVBoxLayout() self._log = log self.text_edit_widget = QTextEdit() layout.addWidget(self.text_edit_widget) buttons = QDialogButtonBox() # buttons.addButton( QDialogButtonBox.StandardButton.Cancel) buttons.addButton(QDialogButtonBox.StandardButton.Save) layout.addWidget(buttons) buttons.button(QDialogButtonBox.StandardButton.Save).clicked.connect( self._save) self.setLayout(layout)
def tesIterator(self): edit = QTextEdit() cursor = edit.textCursor() fmt = QTextCharFormat() frags = [] for i in range(10): fmt.setFontPointSize(i + 10) frags.append("block%d" % i) cursor.insertText(frags[i], fmt) doc = edit.document() block = doc.begin() index = 0 for i in block: self.assertEqual(i.fragment().text(), frags[index]) index += 1
def SetupComponents(self): """ Function to setup status bar, central widget, menu bar """ self.myStatusBar = QStatusBar() self.setStatusBar(self.myStatusBar) self.myStatusBar.showMessage('Ready', 10000) self.textEdit = QTextEdit() self.setCentralWidget(self.textEdit) self.CreateActions() self.CreateMenus() self.fileMenu.addAction(self.newAction) self.fileMenu.addSeparator() self.fileMenu.addAction(self.exitAction) self.editMenu.addAction(self.copyAction) self.fileMenu.addSeparator() self.editMenu.addAction(self.pasteAction) self.helpMenu.addAction(self.aboutAction)
def __init__(self, variable_setting, parent=None): super(FoamDictWidget, self).__init__(parent) self.buttonLayout = QHBoxLayout() self.pushButtonInsert = QPushButton("Insert") #self.pushButtonLoad = QPushButton("Load default") self.pushButtonRestore = QPushButton("Restore") self.pushButtonClear = QPushButton("Clear") self.buttonLayout.addWidget(self.pushButtonInsert) #self.buttonLayout.addWidget(self.pushButtonLoad) self.buttonLayout.addWidget(self.pushButtonRestore) self.buttonLayout.addWidget(self.pushButtonClear) self.buttonPreview = QPushButton('Preview FoamFile write-out') self.textPreview = QTextEdit('') self.textPreview.setVisible(False) self.textPreview.setEnabled(False) self.tableWidget = QTableWidget() #header, should not sort, has vertical scrollbar # set column count, fixed to 2, size of TableItem self.tableWidget.setColumnCount(2) #5self.tableWidget.setHorizontalHeaderItem(0, ) self.tableWidget.setHorizontalHeaderLabels(['key', 'value text']) # set a default row count, insert as needed self.tableWidget.setRowCount(0) #PySide has different name other than @QtCore.pyqtSlot, but PySide.QtCore.SLOT QtCore.QObject.connect(self.pushButtonInsert, QtCore.SIGNAL("clicked()"), self.insertRow) QtCore.QObject.connect(self.pushButtonRestore, QtCore.SIGNAL("clicked()"), self.restoreDict) QtCore.QObject.connect(self.pushButtonClear, QtCore.SIGNAL("clicked()"), self.clearDict) # QtCore.QObject.connect(self.tableWidget, QtCore.SIGNAL("doubleClicked()"), self.showPreview) # does not work for PySide QtCore.QObject.connect(self.buttonPreview, QtCore.SIGNAL("clicked()"), self.showPreview) self._previewing = False self.settings = variable_setting self.restoreDict() self.myLayout = QVBoxLayout() self.myLayout.addLayout(self.buttonLayout) self.myLayout.addWidget(self.tableWidget) self.myLayout.addWidget(self.buttonPreview) self.myLayout.addWidget(self.textPreview) self.setLayout(self.myLayout)
def __init__(self, certText, parent=None): try: super(ShowCertWindow, self).__init__(parent=parent) qWidget = QWidget() layout = QVBoxLayout(qWidget) textEdit = QTextEdit() textEdit.setReadOnly(True) textEdit.setPlainText(certText) layout.addWidget(textEdit) button = QPushButton("OK") button.clicked.connect(self.destroy) layout.addWidget(button) self.setGeometry(300, 300, 500, 300) self.setWindowTitle("CA Certificate") self.setCentralWidget(qWidget) self.show() except e: print(e)
def newwindow(self): import pprint print("##############") pprint.pprint(self.output_of_algorithm) print("##############") self.wid = QWidget() self.wid.resize(250, 150) self.wid.setWindowTitle('NewWindow') self.result = QTextEdit(self.wid) self.result.setText(str(self.output_of_algorithm)) #self.start_airport.addItems(self.airports) self.result.setMinimumHeight(200) self.result.setMaximumHeight(200) self.result.setMinimumWidth(600) self.start_airport.setMaximumWidth(600) # self.start_airport.move(150, 5) self.output_of_algorithm = None self.wid.show()
def __init__(self, parent, remote_documents_service): super(Nonconformity2Widget, self).__init__(parent) self._track_changes = True self._current_qe = None top_layout = QVBoxLayout() self._quality_event_prototype = QualityEventTypePrototype( "kind", _("Kind")) self._quality_event_type_widget = self._quality_event_prototype.edit_widget( self) self._quality_event_type_widget.activated.connect( self.event_type_changed) self._type_label = QLabel(_("Type :")) hlayout = QHBoxLayout() hlayout.addWidget(self._type_label) hlayout.addWidget(self._quality_event_prototype.edit_widget(self)) hlayout.setStretch(0, 0) hlayout.setStretch(1, 1) top_layout.addLayout(hlayout) # self.comments_widget = CommentsWidget(self, self._change_tracker) self.comments_widget = QTextEdit(self) self.comments_widget.textChanged.connect(self.comment_changed) self._description_label = QLabel(_("Description :")) top_layout.addWidget(self._description_label) top_layout.addWidget(self.comments_widget) self.documents = DocumentCollectionWidget( parent=self, doc_service=remote_documents_service, used_category_short_name='Qual.', no_header=True) self.documents.documents_list_changed.connect( self._documents_changed_slot) top_layout.addWidget(self.documents) top_layout.addStretch() self._enable_editing() self.setLayout(top_layout)
def __init__(self,fileName=None): """ Constructor Function """ # QWidget.__init__(self) # self.setWindowTitle("Icon Sample") # self.setGeometry(300, 300, 200, 150) QMainWindow.__init__(self) self.setWindowTitle("Icon Sample") self.setGeometry(300, 300, 200, 150) QToolTip.setFont(QFont("Decorative", 8, QFont.Bold)) self.setToolTip('Our Main Window') self.icon='C:\Users\Hamed\Documents\soheil sites image\imageedit__9411602959.gif' self.textEdit = QTextEdit() self.setCentralWidget(self.textEdit) self.fileName = None self.filters = "Text files (*.txt)" openFile = QAction(QIcon('open.png'), 'Open', self) openFile.setShortcut('Ctrl+O') openFile.setStatusTip('Open new File') openFile.triggered.connect(self.showDialog) menubar = self.menuBar() # fileMenu = menubar.addMenu('&File') # fileMenu.addAction(openFile) self.setGeometry(300, 300, 350, 300) self.setWindowTitle('Example - File Dialog') # self.myNameLE = QLineEdit(self) # self.myAgeLE = QLineEdit(self) # self.myChoiceLE = QLineEdit(self) self.statusLabel = QLabel('Showing Progress') self.progressBar = QProgressBar() self.progressBar.setMinimum(0) self.progressBar.setMaximum(100) ##################@@@@@@@@@@@@@@2 self.threads = [] self.addWorker(MyWorkerThread(1)) self.addWorker(MyWorkerThread(2)) #######################@@@@@@@@@@@@@ self.show()