我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用PySide.QtGui.QWidget()。
def createTaskWidgets(self): '''Create one task widget for every task found in current task store''' ## START OF NAUGHTY CODE # DELETE TASK CONTAINER AND SCROLL AREA SO WE CAN RE-CREATE THEM # FOR SOME REASON RE-USING THE EXISTING ONES DOES NOT SHOW THE TASK WIDGETS self.taskContainer.deleteLater() self.scrollArea.deleteLater() self.taskContainer = QtGui.QWidget() self.scrollArea = QtGui.QScrollArea() self.scrollArea.setWidget(self.taskContainer) self.layout().addWidget(self.scrollArea) ## END OF NAUGHTY CODE self.taskWidgets = [TaskWidget(t, self.taskContainer) for t in self.taskStore.tasks] self.update()
def __init__(self): QtGui.QWidget.__init__(self) self.ui = Ui_Settings() self.ui.setupUi(self) self.tools_path = None self.scripts_path = None self.gs = None self.output_path = None self.threads = 4 self.jobs = 2 self. iteration = 5 self.ui.tools_location_selecet_bn.clicked.connect(self.select_tools_path) self.ui.tools_location_clear_bn.clicked.connect(self.clear_tools_path) self.ui.scripts_location_selecet_bn.clicked.connect(self.select_scripts_path) self.ui.scripts_location_clear_bn.clicked.connect(self.clear_scripts_path) self.ui.threads_spinBox.setValue(self.threads) self.ui.threads_spinBox.setMinimum(1) self.ui.jobs_spinBox.setValue(self.jobs) self.ui.jobs_spinBox.setMinimum(1) self.ui.iteration_spinBox.setValue(self. iteration) self.ui.iteration_spinBox.setMinimum(1) self.ui.output_select_bn.clicked.connect(self.select_output_path) self.ui.output_clear_bn.clicked.connect(self.clear_output_path) self.ui.setting_confirm_frame.accepted.connect(self.confirm) self.ui.setting_confirm_frame.rejected.connect(self.cancel)
def __init__(self, observer, view, fields): self._observer = observer self._fields = fields self._connectors = {} self.logger = module_logger.getChild('Binder') widgets = {} for obj in view.findChildren(QtGui.QWidget): if obj.objectName() in fields and isinstance(obj, tuple(self.bound_widgets)): try: widgets[obj.__class__].append(obj) except KeyError: widgets[obj.__class__] = [] widgets[obj.__class__].append(obj) try: for cls, items in widgets.items(): cntr = self.bound_widgets[cls] for widget in items: self._connectors[widget.objectName()] = cntr(self, widget) except KeyError: pass
def __init__(self, data, low_freq, high_freq, spacing, delay=.01, parent=None): QtGui.QWidget.__init__(self, parent) self._low_freq = low_freq self._high_freq = high_freq self._spacing = spacing self._delay= delay self._data = self._open_data(data) self.render_area = RenderArea(self._data, low_freq, high_freq, spacing, delay) main_layout = QtGui.QGridLayout() main_layout.setContentsMargins(0, 0, 0, 0) main_layout.addWidget(self.render_area, 0, 0) self.setLayout(main_layout) self.setWindowTitle("RfCat Spectrum Analyzer (thanks Ubertooth!)")
def fv(name="vertical",title=''): # w=QtGui.QWidget() t=QtGui.QLabel("my widget") w=MyDockWidget(t,"Reconstruction WB") ### w.setStyleSheet("QWidget { font: bold 18px;color:brown;border-style: outset;border-width: 3px;border-radius: 10px;border-color: blue;}") if title <>'': w.setWindowTitle(title) layout = QtGui.QVBoxLayout() layout.setAlignment(QtCore.Qt.AlignTop) #w.layout=layout #w.setLayout(layout) w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) w.show() # ComboViewShowWidget(w,True) try: FreeCAD.w5.append(w) except: FreeCAD.w5=[w] return w
def fh(name="horizontal",title=''): w=QtGui.QWidget() #w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) ### w.setStyleSheet("QWidget { font: bold 18px;color:blue;border-style: outset;border-width: 3px;border-radius: 10px;border-color: blue;}") layout = QtGui.QHBoxLayout() layout.setAlignment(QtCore.Qt.AlignLeft) w.setLayout(layout) # Gruppenname setzen: #pB= QtGui.QLabel("name") #pB.setStyleSheet("QWidget { font: bold 18px;color:red;border-style: outset;border-width: 3px;border-radius: 10px;border-color: blue;}") #layout.addWidget(pB) if title <>'': w.setWindowTitle(title) #w.show() #ComboViewShowWidget(w,False) w.layout=layout return w
def fh2(name="vertik horizontal",title=''): w=QtGui.QWidget() #w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) ### w.setStyleSheet("QWidget { font: bold 18px;color:blue;border-style: outset;border-width: 3px;border-radius: 10px;border-color: blue;}") layout = QtGui.QVBoxLayout() layout.setAlignment(QtCore.Qt.AlignLeft) w.setLayout(layout) #pB= QtGui.QLabel("name") #pB.setStyleSheet("QWidget { font: bold 18px;color:red;border-style: outset;border-width: 3px;border-radius: 10px;border-color: blue;}") #layout.addWidget(pB) if title <>'': w.setWindowTitle(title) #w.show() #ComboViewShowWidget(w,False) w.layout=layout return w
def main(): #MaxPlus.FileManager.Reset(True) w = QtGui.QWidget() MaxPlus.AttachQWidgetToMax(w) if _GCProtector.widgets : w = _GCProtector.widgets print w w.resize(250, 100) w.setWindowTitle('Window') _GCProtector.widgets = w w.show() main_layout = QtGui.QVBoxLayout() label = QtGui.QLabel("Click button to create a cylinder in the scene") main_layout.addWidget(label) cylinder_btn = QtGui.QPushButton("Cylinder") main_layout.addWidget(cylinder_btn) w.setLayout(main_layout) cylinder_btn.clicked.connect(make_cylinder)
def _get_dialog_parent(self): """ Get the QWidget parent for all dialogs created through show_dialog & show_modal. """ """ Get the QWidget parent for all dialogs created through show_dialog & show_modal. """ # determine the parent widget to use: from tank.platform.qt import QtGui, QtCore if not self._DIALOG_PARENT: if sys.platform == "win32": # for windows, we create a proxy window parented to the # main application window that we can then set as the owner # for all Toolkit dialogs self._DIALOG_PARENT = self._win32_get_proxy_window() else: self._DIALOG_PARENT = QtGui.QApplication.activeWindow() return self._DIALOG_PARENT
def LayoutDesign(self): self.widget = QtGui.QWidget() self.layout = QtGui.QGridLayout(self.widget) self.layout.setSpacing(1) self.layout.setHorizontalSpacing(0) self.layout.setVerticalSpacing(0) self.scroll = QtGui.QScrollArea() self.scroll.setWidgetResizable(True) self.scroll.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.scroll.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn) self.scroll.setWidget(self.widget) self.LayoutChangesOnSliceChange(self.Electrode.slices) self.layout.addWidget(self.CustomWebView, 1, 0,1,25, QtCore.Qt.AlignLeft) self.layout.setContentsMargins(0, 0, 0, 0) self.setContentsMargins(0, 0, 0, 0) self.grid1 = QtGui.QGridLayout() self.grid1.addWidget(self.scroll,3,0) self.setLayout(self.grid1)
def MaintainLayout(self): self.InterfaceWidget =QtGui.QWidget() self.InterfaceWidget.setContentsMargins(0, 0, 0, 0) self.InterfaceLayout = QtGui.QVBoxLayout() ConsensusPlot = QtGui.QHBoxLayout() # self.InterfaceLayout.setContentsMargins(0, 0, 0, 0) # self.communitiesAcrossTimeStep.PlotWidget.setMinimumSize(200,100) # self.communitiesAcrossTimeStep.PlotWidget.setMaximumSize(200,100) # ConsensusPlot.addWidget(self.communitiesAcrossTimeStep.PlotWidget) self.InterfaceLayout.addWidget(self.Visualizer.MainTab) self.InterfaceLayout.setContentsMargins(0, 0, 0, 0) self.InterfaceLayout.addLayout(ConsensusPlot) self.InterfaceLayout.setContentsMargins(0, 0, 0, 0) self.InterfaceWidget.setContentsMargins(0, 0, 0, 0) self.InterfaceWidget.setLayout(self.InterfaceLayout) self.InterfaceWidget.setContentsMargins(0, 0, 0, 0) self.InterfaceWidget.show() # def connectCustomWebView(self, view): # self.view = view # self.Visualizer.SliceInterval.valueChanged[int].connect(self.view.slicesChanged)
def __init__(self, AcrossTimestepUI, AcrossTimestepObject): QtGui.QWidget.__init__(self) self.UIWidget = QtGui.QVBoxLayout() self.Widget1 = QtGui.QWidget() self.AcrossTimestepUI = AcrossTimestepUI self.AcrossTimestepObject = AcrossTimestepObject self.defaultValue = "0.3" self.ConnectControls() self.doControls() self.UIWidget.setContentsMargins(0,0,0,0) self.UIWidget.addWidget(self.AcrossTimestepUI) self.UIWidget.setContentsMargins(0,0,0,0) # self.AcrossTimestepUI.thresholdvalue.hide() self.setLayout(self.UIWidget)
def create_icon_box(self, name, text): style = 'width:48px;height:48px;background-color:white;border-radius:5px;border:1px solid rgb(50,50,50);' icon_label = QtGui.QLabel() icon_label.setStyleSheet(style) icon_label.setMaximumWidth(48) icon_label.setMinimumWidth(48) icon_label.setMaximumHeight(48) icon_label.setMinimumHeight(48) setattr(self, name, icon_label) icon_text = QtGui.QLabel(text) icon_text.setStyleSheet('font-size:10px;') icon_text.setAlignment(QtCore.Qt.AlignCenter) vbox = QVBoxLayout() vbox.setAlignment(QtCore.Qt.AlignCenter) vbox.addWidget(icon_label) vbox.addWidget(icon_text) vbox.setContentsMargins(0, 0, 0, 0) w = QtGui.QWidget() w.setLayout(vbox) w.setMaximumWidth(70) return w
def __init__(self, *args,**kwargs): super(MainWidget, self).__init__(*args,**kwargs) self.setLayout(QtGui.QHBoxLayout()) self.bkg_wdgt = QtGui.QWidget() self.layout().addWidget(self.bkg_wdgt) self.bkg_wdgt.setLayout(QtGui.QHBoxLayout()) self.btn = QtGui.QPushButton("hallo") self.textarea = QtGui.QTextEdit() self.bkg_wdgt.layout().addWidget(self.btn) self.bkg_wdgt.layout().addWidget(self.textarea) self.setWindowFlags(QtCore.Qt.FramelessWindowHint) self.btn.clicked.connect(self.on_btn_clicked) # self.parent_hwnd = None
def __init__(self, sandbox, *args, **kwargs): QtGui.QDockWidget.__init__(self, 'Sources', *args, **kwargs) self.sandbox = sandbox layout = QtGui.QVBoxLayout() layout.setContentsMargins(3, 3, 3, 3) sources = SourcesList(sandbox) sources_add_menu = SourcesAddButton(sandbox) self.setFeatures(QtGui.QDockWidget.DockWidgetFloatable | QtGui.QDockWidget.DockWidgetMovable) self.widget = QtGui.QWidget() self.widget.setLayout(layout) self.widget.layout().addWidget(sources) self.widget.layout().addWidget(sources_add_menu) self.setWidget(self.widget)
def MySaveDialog(target=None): '''widget for save sketch into a file''' lm=getfiles() w=QtGui.QWidget() w.target=target box = QtGui.QVBoxLayout() w.setLayout(box) w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) w.r=QtGui.QPushButton("save selected sketch as file") box.addWidget(w.r) w.r.pressed.connect(lambda :saveSketch(w)) w.show() return w
def dialogV(obj): '''erzeugen dialog vLayout''' w=QtGui.QWidget() box = QtGui.QVBoxLayout() w.setLayout(box) w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) for p in obj.props: pw=createPropWidget( obj,p) box.addWidget(pw) w.r=QtGui.QPushButton("close") box.addWidget(w.r) w.r.pressed.connect(lambda :clear(w)) w.show() return w ##create controller main dialog
def fv3(name="vertical",title=''): ''' vertical layout but not a dock widget''' w=QtGui.QWidget() # w.setStyleSheet("QWidget { font: bold 18px;color:brown;border-style: outset;border-width: 3px;border-radius: 10px;border-color: blue;}") if title <>'': w.setWindowTitle(title) layout = QtGui.QVBoxLayout() layout.setAlignment(QtCore.Qt.AlignTop) #w.layout=layout #w.setLayout(layout) # w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) # w.show() try: FreeCAD.w5.append(w) except: FreeCAD.w5=[w] return w
def init_params(self): QtGui.QWidget().setLayout(self.params_vbox) parts_vbox = QtGui.QGridLayout(self.params_widget) self.hide_button = QtGui.QPushButton('Hide others', self.params_widget) parts_vbox.addWidget(self.hide_button, 0, 0) self.hide_button.clicked.connect(self.hide_others) self.show_button = QtGui.QPushButton('Show all', self.params_widget) parts_vbox.addWidget(self.show_button, 0, 1) self.show_button.clicked.connect(self.show_initial_objects) self.set_transparency_button = QtGui.QPushButton('Set transparent', self.params_widget) parts_vbox.addWidget(self.set_transparency_button, 1, 0) self.set_transparency_button.clicked.connect(self.set_transparency) self.reset_transparency_button = QtGui.QPushButton('Restore transparent', self.params_widget) parts_vbox.addWidget(self.reset_transparency_button, 1, 1) self.reset_transparency_button.clicked.connect(self.restore_transparency) preview_button = QtGui.QPushButton('Preview', self.params_widget) parts_vbox.addWidget(preview_button,2,0,1,2) preview_button.clicked.connect(self.preview)
def __init__(self, data, low_freq, high_freq, spacing, delay=.01, parent=None): QtGui.QWidget.__init__(self, parent) self._low_freq = low_freq self._high_freq = high_freq self._spacing = spacing self._data = self._open_data(data) self.render_area = RenderArea(self._data, low_freq, high_freq, spacing, delay) main_layout = QtGui.QGridLayout() main_layout.setContentsMargins(0, 0, 0, 0) main_layout.addWidget(self.render_area, 0, 0) self.setLayout(main_layout) self.setWindowTitle("RfCat Spectrum Analyzer (thanks Ubertooth!)")
def refreshRelativeFrame(self): # clear the frame of all widgets first for child in self.relative_frame.findChildren(QtGui.QWidget): child.setParent(None) # fill the relative frames list for index in range(self.mRelativeFrameAmount + 1): if not index-self.mRelativeFrameAmount/2 == 0: listWidget = OnionListFrame() listWidget.frame_number.setText(str(index-self.mRelativeFrameAmount/2)) listWidget.frame_opacity_slider.setValue(75/abs(index-self.mRelativeFrameAmount/2)) listWidget.frame_visibility_btn.clicked.connect(self.toggleRelativeFrame) listWidget.frame_opacity_slider.sliderMoved.connect(self.setRelativeOpacity) self.relative_frame_layout.addWidget(listWidget) #
def __init__(self, media, parent): super(VideoMediaView, self).__init__(media, parent) self._widget = QWidget(parent) self._process = QProcess(self._widget) self._process.setObjectName('%s-process' % self.objectName()) self._std_out = [] self._errors = [] self._stopping = False self._mute = False if 'mute' in self._options: self._mute = bool(int(self._options['mute'])) self._widget.setGeometry(media['_geometry']) self.connect(self._process, SIGNAL("error()"), self._process_error) self.connect(self._process, SIGNAL("finished()"), self.stop) self.connect(self._process, SIGNAL("readyReadStandardOutput()"), self.__grep_std_out) self.set_default_widget_prop() self._stop_timer = QTimer(self) self._stop_timer.setSingleShot(True) self._stop_timer.setInterval(1000) self._stop_timer.timeout.connect(self._force_stop)
def __init__(self): super(MultiAutoSettingsDialog, self).__init__() vl = QtGui.QVBoxLayout() self.setLayout(vl) self.headerWidget = QtGui.QWidget() vl.addWidget(self.headerWidget) self.__qsw = QtGui.QStackedLayout() self.__autoWidgets = [] vl.addLayout(self.__qsw) bb = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel) vl.addWidget(bb) bb.accepted.connect(self.accept) bb.rejected.connect(self.reject) self.__saved_pos = QtGui.QCursor.pos()
def __init__(self): QtGui.QWidget.__init__(self) self.ui = Ui_About() self.ui.setupUi(self) self.ui.about_bn.clicked.connect(self.confirm)
def __init__(self): QtGui.QWidget.__init__(self) self.ui = Ui_Manual() self.ui.setupUi(self) self.ui.manual_bn.clicked.connect(self.confirm)
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(529, 329) self.selInfoWidget = QtGui.QWidget(Form) self.selInfoWidget.setGeometry(QtCore.QRect(260, 10, 264, 222)) self.selInfoWidget.setObjectName("selInfoWidget") self.gridLayout = QtGui.QGridLayout(self.selInfoWidget) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setObjectName("gridLayout") self.selDescLabel = QtGui.QLabel(self.selInfoWidget) self.selDescLabel.setText("") self.selDescLabel.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) self.selDescLabel.setWordWrap(True) self.selDescLabel.setObjectName("selDescLabel") self.gridLayout.addWidget(self.selDescLabel, 0, 0, 1, 1) self.selNameLabel = QtGui.QLabel(self.selInfoWidget) font = QtGui.QFont() font.setWeight(75) font.setBold(True) self.selNameLabel.setFont(font) self.selNameLabel.setText("") self.selNameLabel.setObjectName("selNameLabel") self.gridLayout.addWidget(self.selNameLabel, 0, 1, 1, 1) self.selectedTree = DataTreeWidget(self.selInfoWidget) self.selectedTree.setObjectName("selectedTree") self.selectedTree.headerItem().setText(0, "1") self.gridLayout.addWidget(self.selectedTree, 1, 0, 1, 2) self.hoverText = QtGui.QTextEdit(Form) self.hoverText.setGeometry(QtCore.QRect(0, 240, 521, 81)) self.hoverText.setObjectName("hoverText") self.view = FlowchartGraphicsView(Form) self.view.setGeometry(QtCore.QRect(0, 0, 256, 192)) self.view.setObjectName("view") self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def __init__(self, data, low_freq=2.400e9, high_freq=2.483e9, freq_step=1e6, delay=0, parent=None): QtGui.QWidget.__init__(self, parent) self._graph = None self._reticle = None self._data = data self._delay = delay self._frame = None self._persisted_frames = None self._persisted_frames_depth = 350 self._path_max = None self._low_frequency = low_freq #2.400e9 self._high_frequency = high_freq #2.483e9 self._frequency_step = freq_step #1e6 self._high_dbm = 0.0 self._low_dbm = -100.0 self._hide_markers = False self._mouse_x = None self._mouse_y = None self._mouse_x2 = None self._mouse_y2 = None self._thread = SpecanThread(self._data, self._low_frequency, self._high_frequency, self._frequency_step, self._delay, self._new_frame) self._thread.start()
def runwid(text): w=QtGui.QWidget() w.setStyleSheet("QLabel { color: rgb(255, 0, 0); font-size: 20px; background-color: rgba(255, 255, 100, 100); border: 1px solid rgba(188, 188, 188, 250); }") w.setGeometry(800, 400, 10, 10) box = QtGui.QVBoxLayout() w.setLayout(box) w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) l=QtGui.QLabel(text) box.addWidget(l) return w
def dialog(fn): w=QtGui.QWidget() box = QtGui.QVBoxLayout() w.setLayout(box) w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) l=QtGui.QLabel("Path to Image" ) box.addWidget(l) w.anz = QtGui.QLineEdit() w.anz.setText(fn) box.addWidget(w.anz) loff=QtGui.QLabel("Offset Border" ) box.addWidget(loff) w.off = QtGui.QLineEdit() w.off.setText("100") box.addWidget(w.off) w.rotpos=QtGui.QCheckBox("Rot +90") box.addWidget(w.rotpos) w.rotneg=QtGui.QCheckBox("Rot -90") box.addWidget(w.rotneg) w.rot180=QtGui.QCheckBox("Rot 180") box.addWidget(w.rot180) w.r=QtGui.QPushButton("run") box.addWidget(w.r) w.r.pressed.connect(lambda :runw(w)) w.show() return w
def __init__(self, dialer,obj,menu,noclose,*args): QtGui.QWidget.__init__(self, *args) obj.widget=self self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) self.vollabel =QtGui.QLabel( "<b>"+obj.Object.Label+"</b>") if dialer: dial = QtGui.QDial() dial.setNotchesVisible(True) self.dial=dial dial.setMaximum(100) dial.valueChanged.connect(obj.dialer); layout = QtGui.QVBoxLayout() layout.addWidget(self.vollabel) for m in menu: bt=QtGui.QPushButton(m[0]) bt.clicked.connect(m[1]) layout.addWidget(bt) if dialer: layout.addWidget(dial) if not noclose: self.pushButton02 = QtGui.QPushButton("close") self.pushButton02.clicked.connect(self.hide) layout.addWidget(self.pushButton02) self.setLayout(layout) try: self.setWindowTitle(obj.Object.target.Label) except: pass
def setupUi(self, MainWindow): """Setting up UI for Main Window """ MainWindow.setObjectName("MainWindow") MainWindow.resize(804, 600) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.horizontalLayout = QtGui.QHBoxLayout(self.centralwidget) self.horizontalLayout.setObjectName("horizontalLayout") self.txtInput = QtGui.QPlainTextEdit(self.centralwidget) self.txtInput.setObjectName("MarkDtextEdit") self.horizontalLayout.addWidget(self.txtInput) self.txtOutput = QtGui.QTextEdit(self.centralwidget) self.txtOutput.setObjectName("MarkDownView") self.horizontalLayout.addWidget(self.txtOutput) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 804, 21)) self.menubar.setObjectName("menubar") MainWindow.setMenuBar(self.menubar) self.statusbar = QtGui.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def BT_GetMayaWindow(): ptr = apiUI.MQtUtil.mainWindow() if ptr is not None: if BT_MayaVersionNumber < 2014: return wrapinstance(long(ptr), QtCore.QObject) else: return wrapInstance(long(ptr), QtGui.QWidget)
def _handle_command(self, uid): """ Handles an RPC engine command execution request. :param int uid: The unique id of the engine command to run. """ self.logger.debug("Handling command request for uid: %s" % (uid,)) with self.heartbeat_disabled(): from sgtk.platform.qt import QtGui if uid == self.__jump_to_fs_command_id: # jump to fs special command triggered self._jump_to_fs() elif uid == self.__jump_to_sg_command_id: # jump to sg special command triggered self._jump_to_sg() else: # a registered command was triggered for command in self.commands.values(): if command.get("properties", dict()).get("uid") == uid: self.logger.debug( "Executing callback for command: %s" % (command,)) result = command["callback"]() if isinstance(result, QtGui.QWidget): # if the callback returns a widget, keep a handle on it self.__qt_dialogs.append(result)
def setupUI(self): mainLayout = QtGui.QVBoxLayout() self.setLayout(mainLayout) self.buttonLayout = QtGui.QHBoxLayout() self.msg = QtGui.QLabel() self.addTaskButton = QtGui.QPushButton('Add Task') self.addTaskButton.setToolTip('Add a new task to the list') self.sortButton = QtGui.QPushButton('Reverse Sorting') self.sortButton.setCheckable(True) self.sortButton.setToolTip('Push to sort so highest priorities are at the top,\notherwise lowest will be at the top.') self.helpButton = QtGui.QPushButton('?') self.helpButton.setMaximumWidth(30) self.helpButton.setFlat(True) self.helpButton.setToolTip(self.__helpText()) self.hideButton = QtGui.QPushButton('Hide Finished Tasks') self.hideButton.setCheckable(True) self.hideButton.setToolTip('Hide finished tasks to keep the list tidy') self.clipboardButton = QtGui.QPushButton('Copy To Clipboard') self.clipboardButton.setToolTip('Push to copy current task info to cliboard for pasting into emails or other text documents.\nHandy to keep those coordinators happy.') self.buttonLayout.addWidget(self.addTaskButton) self.buttonLayout.addWidget(self.sortButton) self.buttonLayout.addWidget(self.hideButton) self.buttonLayout.addWidget(self.clipboardButton) self.buttonLayout.addSpacing(20) self.buttonLayout.addWidget(self.helpButton) self.layout().addWidget(self.msg) self.layout().addLayout(self.buttonLayout) self.taskContainer = QtGui.QWidget() self.scrollArea = QtGui.QScrollArea() self.scrollArea.setWidget(self.taskContainer) self.layout().addWidget(self.scrollArea) self.createTaskWidgets() self.update()
def mouseReleaseEvent(self, e): super(CorrelationTableDisplay, self).mouseReleaseEvent(e) if not(self.Selectionmode): regionIDS = [] for i in self.selectedItems(): regionIDS.append((i.row(), i.column())) regionIDS = np.asarray(regionIDS) CorrelationTable = self def newwindow(BoxWidget): i,j = np.amin(regionIDS, axis=0) k,l = np.amax(regionIDS, axis=0) np.reshape(regionIDS,(k-i+1,l-j+1,2)) self.bbox = QtGui.QVBoxLayout() # Number of region ids selected and transfered to teh new window NewTable = NewWindowCorrelationTableDisplay(k-i+1,l-j+1,i,k,j,l,CorrelationTable,regionIDS) self.bbox.addWidget(NewTable) BoxWidget.setLayout(self.bbox) # FIX me resizing table contents with hardcoded values BoxWidget.resize(18*(l-j)+120,18*(k-i+1)+140) # BoxWidget.resize(18*(l-j)+120,18*(k-i+1)+140) if self.First: self.newWindowWidget.append(QtGui.QWidget()) newwindow(self.newWindowWidget[0]) self.newWindowWidget[0].show() self.First = False else: self.i = self.i + 1 self.newWindowWidget.append(QtGui.QWidget()) newwindow(self.newWindowWidget[self.i]) self.newWindowWidget[self.i].show()
def mouseReleaseEvent(self, e): super(CorrelationTableDisplay, self).mouseReleaseEvent(e) if not(self.Selectionmode): regionIDS = [] for i in self.selectedItems(): regionIDS.append((i.row(), i.column())) regionIDS = np.asarray(regionIDS) CorrelationTable = self def newwindow(BoxWidget): i,j = np.amin(regionIDS, axis=0) k,l = np.amax(regionIDS, axis=0) np.reshape(regionIDS,(k-i+1,l-j+1,2)) self.bbox = QtGui.QVBoxLayout() NewTable = NewWindowCorrelationTableDisplay(k-i+1,l-j+1,i,k,j,l,CorrelationTable,regionIDS) self.bbox.addWidget(NewTable) BoxWidget.setLayout(self.bbox) # FIX me resizing table contents with hardcoded values BoxWidget.resize(18*(l-j)+120,18*(k-i+1)+140) if self.First: self.newWindowWidget.append(QtGui.QWidget()) newwindow(self.newWindowWidget[0]) self.newWindowWidget[0].show() self.First = False else: self.i = self.i + 1 self.newWindowWidget.append(QtGui.QWidget()) newwindow(self.newWindowWidget[self.i]) self.newWindowWidget[self.i].show()
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) # self.form = self self.form.setWindowTitle(u'Check collisions') self.form.setWindowIcon(QtGui.QIcon(":/data/img/collisions.png")) self.root = None self.obj = None self.tmpFile = None self.transaprency = {} # self.createSolid = QtGui.QCheckBox(u'Create solid on exit') # self.table1 = collisionObjectTable() # self.table2 = collisionObjectTable() # checkButton = QtGui.QPushButton(u"Check") self.connect(checkButton, QtCore.SIGNAL("released ()"), self.preview) # lay = QtGui.QGridLayout(self) lay.addWidget(checkButton, 0, 0, 1, 2) lay.addWidget(QtGui.QLabel(u'First group'), 1, 0, 1, 1) lay.addWidget(self.table1, 2, 0, 1, 1) lay.addWidget(QtGui.QLabel(u'Second group'), 1, 1, 1, 1) lay.addWidget(self.table2, 2, 1, 1, 1) lay.addWidget(self.createSolid, 3, 0, 1, 2) # self.readObjects() self.removeRoot()
def __init__(self, searchPhrase=None, parent=None): QtGui.QWidget.__init__(self, parent) # self.form = self self.form.setWindowIcon(QtGui.QIcon(":/data/img/downloadModel.png")) # if searchPhrase: self.form.setWindowTitle('Download model for {0}'.format(searchPhrase)) url_1 = odnosnik("<a href='http://sourceforge.net/projects/eaglepcb2freecad/files/models/'>FreeCAD-PCB</a>") url_2 = odnosnik("<a href='http://www.tracepartsonline.net/(S(q4odzm45rnnypc4513kjgy45))/content.aspx?SKeywords={0}'>trace<b>parts</b></a>".format(searchPhrase)) url_3 = odnosnik("<a href='http://www.3dcontentcentral.com/Search.aspx?arg={0}'>3D ContentCentral</a>".format(searchPhrase)) else: self.form.setWindowTitle('Download model') url_1 = odnosnik("<a href='http://sourceforge.net/projects/eaglepcb2freecad/files/models/'>FreeCAD-PCB</a>") url_2 = odnosnik("<a href='http://www.tracepartsonline.net/(S(q4odzm45rnnypc4513kjgy45))/content.aspx'>trace<b>parts</b></a>") url_3 = odnosnik("<a href='http://www.3dcontentcentral.com/'>3D ContentCentral</a>") # lay = QtGui.QGridLayout(self) lay.addWidget(dodatkowaIkonka_lista(), 0, 0, 1, 1) lay.addWidget(url_1, 0, 1, 1, 1) lay.addWidget(dodatkowaIkonka_lista(), 1, 0, 1, 1) lay.addWidget(url_2, 1, 1, 1, 1) lay.addWidget(dodatkowaIkonka_klucz(), 1, 2, 1, 1) lay.addWidget(dodatkowaIkonka_lista(), 2, 0, 1, 1) lay.addWidget(url_3, 2, 1, 1, 1) lay.addWidget(dodatkowaIkonka_klucz(), 2, 2, 1, 1) lay.addItem(QtGui.QSpacerItem(5, 20), 3, 0, 1, 3) lay.addWidget(QtGui.QLabel('Printed Circuit Board supported formats: IGS, STEP'), 3, 0, 1, 3) lay.setColumnStretch(1, 10)
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) # self.form = self self.form.setWindowTitle(u"Export object to Pov-Ray") # tab = QtGui.QTabWidget() tab.addTab(self.tabGeneral(), u'General') # lay = QtGui.QVBoxLayout(self) lay.addWidget(tab) #
def _add_pane_3(self): """ Add pane 3, an intermediate pane while we are sampling the posterior. """ self.p3 = QtGui.QWidget() self.layout.addWidget(self.p3) # Pane 3 p3_layout = QtGui.QGridLayout() self.p3.setLayout(p3_layout) p3_layout.addItem(QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding), 0, 1, 1, 1) self.p3_progressbar = QtGui.QProgressBar(self) self.p3_progressbar.setFocusPolicy(QtCore.Qt.NoFocus) p3_layout.addWidget(self.p3_progressbar, 2, 1, 1, 1) p3_layout.addItem(QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum), 2, 2, 1, 1) p3_layout.addItem(QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum), 2, 0, 1, 1) self.p3_label = QtGui.QLabel(self) self.p3_label.setText("Sampling posterior") self.p3_label.setAlignment(QtCore.Qt.AlignCenter) p3_layout.addWidget(self.p3_label, 1, 1, 1, 1) p3_layout.addItem(QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding), 3, 1, 1, 1) return None
def SignalForWebViewE(self, Start, End, Slice): self.Start = Start self.End = End StartSlice = Start/self.Electrode.slices EndSlice = End/self.Electrode.slices gettingSmallMultipleNumber = (End-Start)/Slice self.LayoutChangesOnSliceChange(self.Electrode.slices) if not(self.PutAllLayout): if EndSlice - StartSlice > -1: q = StartSlice IterationNo = EndSlice-StartSlice if IterationNo ==0: IterationNo = 1 for i in range(IterationNo): WidgetTemp=self.Electrode.SmallMultipleElectrode[q] WidgetTemp.show() WidgetTemp.setMinimumSize(QtCore.QSize(SliceSizes,SliceSizes)) WidgetTemp.setMaximumSize(QtCore.QSize(SliceSizes,SliceSizes)) if i < 5: self.layout.addWidget(WidgetTemp, 0, i ,QtCore.Qt.AlignCenter) else: self.layout.addWidget(WidgetTemp, 2, (i-5) ,QtCore.Qt.AlignCenter) q=q+1 C = self.layout.itemAtPosition(0, (EndSlice-StartSlice)+1) while (C is not None): Widget = C.widget() self.layout.removeWidget(Widget) Widget.hide() i = i + 1 C = self.layout.itemAtPosition(0, i) A = QtGui.QWidget() A.setMinimumSize(QtCore.QSize(SliceSizes,SliceSizes)) A.setMaximumSize(QtCore.QSize(SliceSizes,SliceSizes)) for i in range(5): self.layout.addWidget(A, 2, i)