def __init__(self, parent = None): QWidget.__init__(self, parent) self.parent = parent self.lineSpacing = self.parent.fm.lineSpacing() self.tBoxHeight = self.parent.fm.height() self.tBoxWidth = 7*self.lineSpacing self.edgeLen = 2*self.parent.vsepara + 7*self.lineSpacing # edge of a single square
def __init__(self, parent=None): QWidget.__init__(self, parent) self.setupUi(self) machine = QStateMachine(self) s11 = QState() s11.setObjectName('s11') s11.assignProperty(self.lineEdit, 'text', u'Состояние 1') s12 = QState() s12.setObjectName('s12') s12.assignProperty(self.lineEdit, 'text', u'Состояние 2') s13 = QState() s13.setObjectName('s13') s13.assignProperty(self.lineEdit, 'text', u'Состояние 3') # s11.entered.connect(self.s11entered) s11.addTransition(self.ChangeState.clicked, s12) s12.addTransition(self.ChangeState.clicked, s13) s13.addTransition(self.ChangeState.clicked, s11) machine.addState(s11) machine.addState(s12) machine.addState(s13) machine.setInitialState(s11) machine.start()
def __init__(self, text, minValue, maxValue, defaultValue ): QWidget.__init__( self ) validator = QDoubleValidator(minValue, maxValue, 2, self ) mainLayout = QHBoxLayout( self ) checkBox = QCheckBox() checkBox.setFixedWidth( 115 ) checkBox.setText( text ) lineEdit = QLineEdit() lineEdit.setValidator( validator ) lineEdit.setText( str(defaultValue) ) slider = QSlider( QtCore.Qt.Horizontal ) slider.setMinimum( minValue*100 ) slider.setMaximum( maxValue*100 ) slider.setValue( defaultValue ) mainLayout.addWidget( checkBox ) mainLayout.addWidget( lineEdit ) mainLayout.addWidget( slider ) QtCore.QObject.connect( slider, QtCore.SIGNAL( 'valueChanged(int)' ), self.syncWidthLineEdit ) QtCore.QObject.connect( lineEdit, QtCore.SIGNAL( 'textChanged(QString)' ), self.syncWidthSlider ) QtCore.QObject.connect( checkBox, QtCore.SIGNAL( "clicked()" ), self.updateEnabled ) self.checkBox = checkBox self.slider = slider self.lineEdit = lineEdit self.updateEnabled()
def __init__(self, parent=None): QWidget.__init__(self, parent) self.__parent = parent self.title = "Add Designation" self.designation = ValidatingLineEdit("Designation", "[a-zA-Z0-9-_\s]+", self) self.da = ValidatingLineEdit("Dearness Allowance", QDoubleValidator(), self) self.hra = ValidatingLineEdit("House Rent Allowance", QDoubleValidator(), self) self.ta = ValidatingLineEdit("Transport Allowance", QDoubleValidator(), self) self.it = ValidatingLineEdit("Income Tax", QDoubleValidator(), self) self.pt = ValidatingLineEdit("Professional Tax", QDoubleValidator(), self) # inputs whos validity needs to checked are put in a list # so that we can loop through them to check validity self.inputs = [ self.designation, self.da, self.hra, self.ta, self.it, self.pt ] self.bttnAddDesignation = QPushButton("Add Designation") self.bttnCancel = QPushButton("Cancel") self.bttnAddDesignation.setObjectName("OkButton") self.bttnCancel.setObjectName("CancelButton") self.bttnCancel.clicked.connect(self.goBack) self.bttnAddDesignation.clicked.connect(self.add) self.setupUI()
def __init__(self, text, validator, minValue, maxValue): QWidget.__init__(self) layout = QHBoxLayout(self) checkBox = QCheckBox() checkBox.setFixedWidth(115) checkBox.setText(text) layout.addWidget(checkBox) hLayoutX = QHBoxLayout() lineEditXMin = QLineEdit() lineEditXMax = QLineEdit() hLayoutX.addWidget(lineEditXMin) hLayoutX.addWidget(lineEditXMax) lineEditXMin.setValidator(validator) lineEditXMax.setValidator(validator) lineEditXMin.setText(str(minValue)) lineEditXMax.setText(str(maxValue)) hLayoutY = QHBoxLayout() lineEditYMin = QLineEdit() lineEditYMax = QLineEdit() hLayoutY.addWidget(lineEditYMin) hLayoutY.addWidget(lineEditYMax) lineEditYMin.setValidator(validator) lineEditYMax.setValidator(validator) lineEditYMin.setText(str(minValue)) lineEditYMax.setText(str(maxValue)) hLayoutZ = QHBoxLayout() lineEditZMin = QLineEdit() lineEditZMax = QLineEdit() hLayoutZ.addWidget(lineEditZMin) hLayoutZ.addWidget(lineEditZMax) lineEditZMin.setValidator(validator) lineEditZMax.setValidator(validator) lineEditZMin.setText(str(minValue)) lineEditZMax.setText(str(maxValue)) layout.addLayout(hLayoutX) layout.addLayout(hLayoutY) layout.addLayout(hLayoutZ) self.checkBox = checkBox self.lineEditX_min = lineEditXMin self.lineEditX_max = lineEditXMax self.lineEditY_min = lineEditYMin self.lineEditY_max = lineEditYMax self.lineEditZ_min = lineEditZMin self.lineEditZ_max = lineEditZMax self.lineEdits = [ lineEditXMin, lineEditXMax, lineEditYMin, lineEditYMax, lineEditZMin, lineEditZMax ] QtCore.QObject.connect(checkBox, QtCore.SIGNAL("clicked()"), self.updateEnabled) self.updateEnabled()
def __init__(self, parent, mode=Mode.Start): QWidget.__init__(self, parent) self.buttons = {} button = QPushButton('start') button.clicked.connect(lambda: self.start.emit()) self.buttons['start'] = button button = QPushButton('pause') button.clicked.connect(lambda: self.pause.emit()) self.buttons['pause'] = button button = QPushButton('resume') button.clicked.connect(lambda: self.resume.emit()) self.buttons['resume'] = button button = QPushButton('stop') button.clicked.connect(lambda: self.stop.emit()) self.buttons['stop'] = button box = QHBoxLayout() box.addWidget(self.buttons['start']) box.addWidget(self.buttons['pause']) box.addWidget(self.buttons['resume']) box.addWidget(self.buttons['stop']) self.setLayout(box) self.toggle_buttons(mode)
def __init__(self, parent=None): QWidget.__init__(self, parent) self.__parent = parent self.setWindowTitle("Add Employee") self.id = QLineEdit(self) self.id.setValidator(QRegExpValidator(QRegExp("[a-zA-Z0-9-_]+"))) self.name = QLineEdit(self) self.name.setValidator(QRegExpValidator(QRegExp("[a-zA-Z\s]+"))) self.designation = QComboBox(self) # self.designation.addItems(DatabaseManager.db.getDesignations()) self.originalPay = QLineEdit(self) self.originalPay.setValidator(QDoubleValidator()) self.originalPayGrade = QLineEdit(self) self.originalPayGrade.setValidator(QDoubleValidator()) self.DOJ = DatePicker(self) self.pan = QLineEdit(self) self.pan.setValidator(QRegExpValidator(QRegExp("[A-Z]{5}\d{4}[A-Z]"))) self.bttnAddEmployee = QPushButton("Add Employee") self.bttnCancel = QPushButton("Cancel") self.bttnAddEmployee.setObjectName("OkButton") self.bttnCancel.setObjectName("CancelButton") self.bttnCancel.clicked.connect(self.goBack) self.bttnAddEmployee.clicked.connect(self.add) self.designation.addItems(DatabaseManager.db.getDesignations()) self.setupUI()
def __init__(self, *args, **kwargs ): QWidget.__init__( self, *args ) title = "" if kwargs.has_key( 'title' ): title = kwargs['title'] self.infoPath = cmds.about(pd=True) + "/sg/fingerWeightCopy/Widget_LoadVertex_%s.txt" % title sgCmds.makeFile( self.infoPath ) vLayout = QVBoxLayout( self ); vLayout.setContentsMargins(0,0,0,0) groupBox = QGroupBox( title ) groupBox.setAlignment( QtCore.Qt.AlignCenter ) vLayout.addWidget( groupBox ) hLayout = QHBoxLayout() lineEdit = QLineEdit() button = QPushButton("Load"); button.setFixedWidth( 50 ) hLayout.addWidget( lineEdit ) hLayout.addWidget( button ) groupBox.setLayout( hLayout ) self.lineEdit = lineEdit QtCore.QObject.connect( button, QtCore.SIGNAL( "clicked()" ), self.loadVertex ) self.loadInfo()
def __init__(self ): QWidget.__init__( self ) layout = QVBoxLayout( self ) label = QLabel() listWidget = QListWidget() listWidget.setSelectionMode( QAbstractItemView.ExtendedSelection ) hLayout = QHBoxLayout() buttonLoad = QPushButton( "LOAD") buttonRemove = QPushButton( "REMOVE") hLayout.addWidget( buttonLoad ) hLayout.addWidget( buttonRemove ) layout.addWidget( label ) layout.addWidget( listWidget ) layout.addLayout( hLayout ) self.label = label self.listWidget = listWidget self.buttonLoad = buttonLoad self.buttonRemove = buttonRemove QtCore.QObject.connect( self.buttonLoad, QtCore.SIGNAL( 'clicked()' ), self.loadCommand ) QtCore.QObject.connect( self.buttonRemove, QtCore.SIGNAL( 'clicked()' ), self.removeCommand )
def __init__(self, parent=None): QWidget.__init__(self) self.setMinimumSize(640, 480) self.setMaximumSize(self.minimumSize()) # register this callbacks to interact with the faces and the camera # image before the widget will view the frame self.image_callback = None self.face_callback = None # init view with correct size, depth, channels self.frame = cv.CreateImage((640, 480), cv.IPL_DEPTH_8U, 3) self.storage = cv.CreateMemStorage() self.capture = cv.CaptureFromCAM(0) self.face_cascade = cv.Load(CSC_PATH + "haarcascade_frontalface_alt.xml") self.fd_wait_frames = 1 self._fd_wait = self.fd_wait_frames # get first frame self._query_frame() # set refresh rate self.timer = QTimer(self) self.timer.timeout.connect(self._query_frame) self.timer.start(75)
def __init__(self): 'Makes GUI' QWidget.__init__(self) self.setWindowTitle("Search window") self.fn1 = "" self.fn2 = "" L1 = [] st = os.getcwd() L = os.listdir(st) for filenames in L: if (".txt" in filenames or ".csv" in filenames): L1.append(filenames) self.files1 = QComboBox() self.files2 = QComboBox() #self.files1.setText("SatelliteDataFile") #print(self.files1) #print(self.files2) self.files1.addItems(L1) self.files1.setCurrentIndex(-1) self.files2 = QComboBox() self.files2.addItems(L1) self.files2.setCurrentIndex(-1) self.files1.currentIndexChanged.connect( lambda: self.returnString(self.files1)) self.files2.currentIndexChanged.connect( lambda: self.returnString(self.files2)) self.setUpUI()
def __init__(self): QWidget.__init__(self) layout = QVBoxLayout(self) label = QLabel() listWidget = QListWidget() listWidget.setSelectionMode(QAbstractItemView.ExtendedSelection) hLayout = QHBoxLayout() buttonLoad = QPushButton("LOAD") buttonRemove = QPushButton("REMOVE") hLayout.addWidget(buttonLoad) hLayout.addWidget(buttonRemove) layout.addWidget(label) layout.addWidget(listWidget) layout.addLayout(hLayout) self.label = label self.listWidget = listWidget self.buttonLoad = buttonLoad self.buttonRemove = buttonRemove QtCore.QObject.connect(self.buttonLoad, QtCore.SIGNAL('clicked()'), self.loadCommand) QtCore.QObject.connect(self.buttonRemove, QtCore.SIGNAL('clicked()'), self.removeCommand)
def __init__(self): QWidget.__init__(self) self.title = "报告" self.__path = None self.__service = ReportDetService() # report view self.__wid_display = QWebView() # buttons _wid_buttons = ViewButtons( [dict(id="refresh", name=u'更新'), dict(id="export", name=u'导出')]) _wid_buttons.align_back() # main layout _layout = QVBoxLayout() _layout.addWidget(self.__wid_display) _layout.addWidget(_wid_buttons) self.setLayout(_layout) _layout.setContentsMargins(0, 0, 0, 0)
def __init__(self, parent=None): """ Creates the widget. :param parent: Optional parent widget """ QWidget.__init__(self, parent) StyledObject.__init__(self) #: The designer ui (public so that user may access the internal ui (this might be useful for e.g. people who # would to replace the default actions icons) self.ui = editor_ui.Ui_Form() self.ui.setupUi(self) # setup a weakref on the code edit widget self.codeEdit.editor = weakref.ref(self) #: Map of installed modes self.__modes = {} #: Map of installed panels self.__panels = {} self.ui.layoutLeft.setDirection(QBoxLayout.RightToLeft) self.ui.layoutTop.setDirection(QBoxLayout.BottomToTop) # Maps the ui layouts to a zone key self.__zones = { self.PANEL_ZONE_TOP: self.ui.layoutTop, self.PANEL_ZONE_BOTTOM: self.ui.layoutBottom, self.PANEL_ZONE_LEFT: self.ui.layoutLeft, self.PANEL_ZONE_RIGHT: self.ui.layoutRight} self.__logger = logging.getLogger( __name__ + "." + self.__class__.__name__)
def __init__(self): QWidget.__init__(self) self.title = u"页面" # Search condition widget self.__wid_search_cond = ViewSearch(def_view_page_def) self.__wid_search_cond.set_col_num(2) self.__wid_search_cond.create() # Column widget self.__wid_page_def = ViewPageDefMag() self.__wid_page_det = ViewPageDetMag() # Bottom layout _layout_bottom = QHBoxLayout() _layout_bottom.addWidget(self.__wid_page_def) _layout_bottom.addWidget(self.__wid_page_det) # Main layout _layout_main = QVBoxLayout() _layout_main.addWidget(self.__wid_search_cond) _layout_main.addLayout(_layout_bottom) _layout_main.setContentsMargins(0, 0, 0, 0) _layout_main.setSpacing(0) self.setLayout(_layout_main) self.__wid_page_def.sig_selected.connect( self.__wid_page_det.set_page_id) self.__wid_page_def.sig_search.connect(self.search_definition) self.__wid_page_def.sig_delete.connect(self.__wid_page_det.clean) self.__wid_page_det.sig_selected[str].connect(self.sig_selected.emit)
def __init__(self, parent=None): QWidget.__init__(self, parent) self.serviceManager = QServiceManager(self) self.registerExampleServices() self.initWidgets() self.reloadServicesList() self.setWindowTitle(self.tr("Services Browser"))
def __init__(self, *args, **kwargs ): QWidget.__init__( self, *args, **kwargs ) mainLayout = QHBoxLayout( self ) mainLayout.setContentsMargins(0,0,0,0) label = QLabel( "Aim Direction : " ) lineEdit1 = QLineEdit() lineEdit2 = QLineEdit() lineEdit3 = QLineEdit() verticalSeparator = Widget_verticalSeparator() checkBox = QCheckBox( "Set Auto" ) mainLayout.addWidget( label ) mainLayout.addWidget( lineEdit1 ) mainLayout.addWidget( lineEdit2 ) mainLayout.addWidget( lineEdit3 ) mainLayout.addWidget( verticalSeparator ) mainLayout.addWidget( checkBox ) validator = QDoubleValidator( -10000.0, 10000.0, 2 ) lineEdit1.setValidator( validator ) lineEdit2.setValidator( validator ) lineEdit3.setValidator( validator ) lineEdit1.setText( "0.0" ) lineEdit2.setText( "1.0" ) lineEdit3.setText( "0.0" ) checkBox.setChecked( True ) self.label = label; self.lineEdit1 = lineEdit1; self.lineEdit2 = lineEdit2; self.lineEdit3 = lineEdit3; self.checkBox = checkBox self.setVectorEnabled() QtCore.QObject.connect( checkBox, QtCore.SIGNAL( 'clicked()' ), self.setVectorEnabled )
def __init__(self, parent=None): QWidget.__init__(self) # Create the QVBoxLayout that lays out the whole form self.main_panel = QHBoxLayout() self.lpanel = QHBoxLayout() self.rpanel = QVBoxLayout() self.plot_box = QHBoxLayout() self.summary_box = QHBoxLayout() # Control widget self.control = psim_control.ControlLayout() self.control.sim_button.clicked.connect(self.button_pressed) # Plot Widget self.graph = psim_plot.MatplotlibWidget() # Summary Widget self.summary = psim_summary.SummaryLayout() # Adding plot to left panel and control widget to right panel self.lpanel.addWidget(self.control) self.rpanel.addWidget(self.graph) self.rpanel.addWidget(self.summary) # Adding lpanel and rpanel widget to the main MainWindow self.main_panel.addLayout(self.lpanel) self.main_panel.addLayout(self.rpanel) # self.main_panel.addStretch(1) self.setLayout(self.main_panel) self.df = None
def __init__(self, parent =None, proxy =None): """Creates a new instance of PyGlassBackgroundParent.""" QWidget.__init__(self, parent) self._gui = proxy if proxy else parent self._log = parent.log if parent and hasattr(parent, 'log') else None if not self._log: self._log = Logger(self)
def __init__(self, title, *args, **kwargs ): QWidget.__init__( self, *args ) self.infoPath = cmds.about(pd=True) + "/sg/fingerWeightCopy/Widget_loadJoints_%s.txt" % title sgCmds.makeFile( self.infoPath ) layout = QVBoxLayout( self ); layout.setContentsMargins(0,0,0,0) groupBox = QGroupBox( title ) layout.addWidget( groupBox ) baseLayout = QVBoxLayout() groupBox.setLayout( baseLayout ) listWidget = QListWidget() hl_buttons = QHBoxLayout(); hl_buttons.setSpacing( 5 ) b_addSelected = QPushButton( "Add Selected" ) b_clear = QPushButton( "Clear" ) hl_buttons.addWidget( b_addSelected ) hl_buttons.addWidget( b_clear ) baseLayout.addWidget( listWidget ) baseLayout.addLayout( hl_buttons ) self.listWidget = listWidget QtCore.QObject.connect( listWidget, QtCore.SIGNAL( "itemClicked(QListWidgetItem*)" ), self.selectJointFromItem ) QtCore.QObject.connect( b_addSelected, QtCore.SIGNAL("clicked()"), self.addSelected ) QtCore.QObject.connect( b_clear, QtCore.SIGNAL( "clicked()" ), self.clearSelected ) self.otherWidget = None self.loadInfo()
def __init__(self, fileInfo, gallery, parent=None, flags=Qt.Widget): QWidget.__init__(self, parent, flags) self.setLayout(QFormLayout(parent=self)) self.request = QGalleryQueryRequest(gallery, self) self.request.setFilter( QDocumentGallery.filePath.equals(fileInfo.absoluteFilePath())) self.resultSet = None self.propertyKeys = [] self.widgets = [] propertyNames = [ QDocumentGallery.fileName, QDocumentGallery.mimeType, QDocumentGallery.path, QDocumentGallery.fileSize, QDocumentGallery.lastModified, QDocumentGallery.lastAccessed, ] labels = [ self.tr('File Name'), self.tr('Type'), self.tr('Path'), self.tr('Size'), self.tr('Modified'), self.tr('Accessed'), ] self.requestProperties(QDocumentGallery.File, propertyNames, labels)
def __init__(self, parent=None): QWidget.__init__(self, parent) self.setupUi(self) self.settings = QSettings(QSettings.IniFormat, QSettings.UserScope, COMPANY, APPNAME) self.restoreGeometry(self.settings.value(self.__class__.__name__)) self.images = [] if len(sys.argv) > 1: d = QDir(path=sys.argv[1]) else: d = QDir(path=QFileDialog.getExistingDirectory()) d.setNameFilters(['*.png']) d.setFilter(QDir.Files or QDir.NoDotAndDotDot) d = QDirIterator(d) images = [] while d.hasNext(): images.append(d.next()) for i in images: print i self.images = [QImage(i) for i in images] self.images += [crop_image_from_file(i, 50)[0] for i in images]
def __init__(self, sim): QWidget.__init__(self) self._sim = sim self._screen = None self._rotate = 0 self.setLayout(QGridLayout()) self.invalidate()
def __init__(self, name, arg_dict, pos = "side", max_size = 200): QWidget.__init__(self) self.setContentsMargins(1, 1, 1, 1) if pos == "side": self.layout1=QHBoxLayout() else: self.layout1 = QVBoxLayout() self.layout1.setContentsMargins(1, 1, 1, 1) self.layout1.setSpacing(1) self.setLayout(self.layout1) self.cbox = QCheckBox() # self.efield.setMaximumWidth(max_size) self.cbox.setFont(QFont('SansSerif', 12)) self.label = QLabel(name) # self.label.setAlignment(Qt.AlignLeft) self.label.setFont(QFont('SansSerif', 12)) self.layout1.addWidget(self.label) self.layout1.addWidget(self.cbox) self.arg_dict = arg_dict self.name = name self.mytype = type(self.arg_dict[name]) if self.mytype != bool: self.cbox.setChecked(bool(self.arg_dict[name])) else: self.cbox.setChecked(self.arg_dict[name]) self.cbox.toggled.connect(self.when_modified) self.when_modified()
def __init__(self, *args, **kwargs ): self.uiInfoPath = Window.infoBaseDir + '/Widget_ctlListGroup.json' QWidget.__init__( self, *args, **kwargs ) mainLayout = QVBoxLayout( self ) buttonLayout = QHBoxLayout() gridLayout = QGridLayout() mainLayout.addLayout( buttonLayout ) mainLayout.addLayout( gridLayout ) gridLayout.setSpacing(5) gridLayout.setVerticalSpacing(5) b_addList = QPushButton( "Add List" ) b_removeList = QPushButton( "Remove List" ) buttonLayout.addWidget( b_addList ) buttonLayout.addWidget( b_removeList ) w_ctlList = Widget_ctlList() gridLayout.addWidget( w_ctlList ) self.__gridLayout = gridLayout QtCore.QObject.connect( b_addList, QtCore.SIGNAL( "clicked()" ), self.addList ) QtCore.QObject.connect( b_removeList, QtCore.SIGNAL( "clicked()" ), self.removeList ) self.loadInfo()
def __init__(self, name, arg_dict, pos = "side", max_size = 200): QWidget.__init__(self) self.setContentsMargins(1, 1, 1, 1) if pos == "side": self.layout1=QHBoxLayout() else: self.layout1 = QVBoxLayout() self.layout1.setContentsMargins(1, 1, 1, 1) self.layout1.setSpacing(1) self.setLayout(self.layout1) self.efield = QLineEdit("Default Text") # self.efield.setMaximumWidth(max_size) self.efield.setFont(QFont('SansSerif', 12)) self.label = QLabel(name) # self.label.setAlignment(Qt.AlignLeft) self.label.setFont(QFont('SansSerif', 12)) self.layout1.addWidget(self.label) self.layout1.addWidget(self.efield) self.arg_dict = arg_dict self.name = name self.mytype = type(self.arg_dict[name]) if self.mytype != str: self.efield.setText(str(self.arg_dict[name])) self.efield.setMaximumWidth(50) else: self.efield.setText(self.arg_dict[name]) self.efield.setMaximumWidth(100) self.efield.textChanged.connect(self.when_modified)
def __init__(self, fileInfo, gallery, parent=None, flags=Qt.Widget): QWidget.__init__(self, parent, flags) self.setLayout(QFormLayout(parent=self)) self.request = QGalleryQueryRequest(gallery, self) self.request.setFilter(QDocumentGallery.filePath.equals(fileInfo.absoluteFilePath())) self.resultSet = None self.propertyKeys = [] self.widgets = [] propertyNames = [ QDocumentGallery.fileName, QDocumentGallery.mimeType, QDocumentGallery.path, QDocumentGallery.fileSize, QDocumentGallery.lastModified, QDocumentGallery.lastAccessed, ] labels = [ self.tr('File Name'), self.tr('Type'), self.tr('Path'), self.tr('Size'), self.tr('Modified'), self.tr('Accessed'), ] self.requestProperties(QDocumentGallery.File, propertyNames, labels)
def __init__(self, config, parent=None, **kwargs): QWidget.__init__(self, parent) self.startTime = None self.numDataPoints = 0 self.datasets = {} for display in config['displays']: self.datasets[display['field']] = self.createDatasetForDisplay(display) self.graph = PlotWidget(title=config['title'], labels=config['labels']) # Only add a legend to the graph if there is more than one dataset displayed on it if len(self.datasets) > 1: self.graph.addLegend() # Show grid lines self.graph.showGrid(x=True, y=True) for _, dataset in self.datasets.items(): self.graph.addItem(dataset['plotData']) vbox = QVBoxLayout() vbox.addWidget(self.graph) self.setLayout(vbox)
def __init__(self, origin, target_center, clip): QWidget.__init__(self) self.__origin = origin self.__target_center = target_center self.__clip = clip # Default flag values self.__flag = 0 self.__finished = False self.__release = False # Default animation speed self.__speed = 0.006 # Default release fade out step counts self.__releaseSpeed = 30 # Default color self.__color = MColors.PRIMARY_COLOR # Default maximum radius of the ripple self.__maxRadius = 23 # Default minimum radius of the ripple self.__r = 1 # Default minimum opacity self.__minOpacity = 30 # Default maximum opacity self.__maxOpacity = 255 # Counter used in release animation self.__i = 0
def __init__(self, parent=None): QWidget.__init__(self, parent) self.setupUi(self) self.current_directory = None self.settings = QSettings(QSettings.IniFormat, QSettings.UserScope, COMPANY, APPNAME) self.restoreGeometry(self.settings.value(self.__class__.__name__)) self.splitter.restoreState(self.settings.value(SPLITTER)) self.current_directory = self.settings.value(CURRENT_DIRECTORY) self.white_albatross = WhiteAlbatrossWidget() self.white_albatross.figuresChanged.connect(self.on_figures_changed) self.workLayout.insertWidget(1, self.white_albatross) self.type.currentIndexChanged.connect(self.white_albatross.setType) self.type.setCurrentIndex( int(self.settings.value(LAST_FIGURE_TYPE, defaultValue=0))) self.addImages.clicked.connect(self.add_images_click) self.openFolder.clicked.connect(self.open_folder_clicked) self.removeImages.clicked.connect(self.remove_images) self.imagesList.itemSelectionChanged.connect(self.item_selected) self.deleteFigure.clicked.connect(self.delete_figure) self.figures.customContextMenuRequested.connect( self.figures_context_menu) if self.current_directory: self.open_folder() self.imagesList.setCurrentRow( int(self.settings.value(SELECTED_IMAGE, defaultValue=0)))
def __init__(self, parent = None): QWidget.__init__(self, parent) self.serviceManager = QServiceManager(self) self.registerExampleServices() self.initWidgets() self.reloadServicesList() self.setWindowTitle(self.tr("Services Browser"))
def __init__(self, parent=None): QWidget.__init__(self, parent) self.__parent = parent self.setWindowTitle("Add Designation") self.designation = QLineEdit() self.da = QLineEdit() self.da.setValidator(QDoubleValidator()) self.hra = QLineEdit() self.hra.setValidator(QDoubleValidator()) self.ta = QLineEdit() self.ta.setValidator(QDoubleValidator()) self.it = QLineEdit() self.it.setValidator(QDoubleValidator()) self.pt = QLineEdit() self.pt.setValidator(QDoubleValidator()) self.bttnAddDesignation = QPushButton("Add Designation") self.bttnCancel = QPushButton("Cancel") self.bttnAddDesignation.setObjectName("OkButton") self.bttnCancel.setObjectName("CancelButton") self.bttnCancel.clicked.connect(self.goBack) self.bttnAddDesignation.clicked.connect(self.add) self.setupUI()
def __init__(self,parent=None,measdata=[[1,3,2],[3,5,7]],header=["index","prime numbers"],SymbolSize=10,linecolor='y',pointcolor='b',title='Plot Window'): # This class derivates from a Qt MainWindow so we have to call # the class builder ".__init__()" #QMainWindow.__init__(self) QWidget.__init__(self) # "self" is now a Qt Mainwindow, then we load the user interface # generated with QtDesigner and call it self.ui self.ui = Plot2DDataWidget_Ui.Ui_Plot2DData() # Now we have to feed the GUI building method of this object (self.ui) # with a Qt Mainwindow, but the widgets will actually be built as children # of this object (self.ui) self.ui.setupUi(self) self.setWindowTitle(title) self.x_index=0 self.y_index=0 self.curve=self.ui.plot_area.plot(pen=linecolor) self.curve.setSymbolBrush(pointcolor) self.curve.setSymbol('o') self.curve.setSymbolSize(SymbolSize) self.parent=parent self.measdata=measdata self.header=header self.update_dropdown_boxes(header) self.update_plot_timer = QTimer() self.update_plot_timer.setSingleShot(True) #The timer would not wait for the completion of the task otherwise self.update_plot_timer.timeout.connect(self.autoupdate) if self.ui.auto_upd.isChecked():self.autoupdate()
def __init__(self): QWidget.__init__(self) # Current case id self.__step_id = None self.__win_operate = ViewOperate() # Model self.__model = StepDetModel() self.__model.usr_set_definition(def_view_step) # Control _control = StepDetControl(def_view_step) # Data result display widget _wid_display = ViewTable() _wid_display.set_model(self.__model) _wid_display.set_control(_control) # Context menu _menu_def = [ dict(NAME=u"增加", STR="sig_add"), dict(NAME=u"删除", STR="sig_del"), dict(NAME=u"增加数据", STR="sig_data") ] _wid_display.create_context_menu(_menu_def) # Buttons widget _wid_buttons = ViewButtons([ dict(id="add", name=u"增加"), dict(id="delete", name=u"删除"), dict(id="update", name=u"修改", type="CHECK") ], "VER") # win_add self.__win_add = ViewAdd(def_view_step) self.__win_add.sig_operate.connect(self.__win_operate.show) self.__win_operate.sig_submit.connect(self.get_operate) # win add data self.__win_data = ViewDataAdd() # Layout _layout = QHBoxLayout() _layout.addWidget(_wid_display) _layout.addWidget(_wid_buttons) _layout.setContentsMargins(0, 0, 0, 0) self.setLayout(_layout) # Connection _wid_buttons.sig_clicked.connect(self.__operate) self.__win_add.sig_submit.connect(self.add) _wid_display.sig_context.connect(self.__context) # 右键菜单 _wid_display.clicked.connect(self.__model.usr_set_current_data)
def __init__(self): QWidget.__init__(self) self.title = u"执行" # View RunDef self.__wid_run_def = ViewRunDef() # View ReportDet self.__wid_report_det = ViewReportDet() # Search condition widget self.__wid_search_cond = ViewSearch(def_view_run_def) self.__wid_search_cond.create() # 底部 layout _layout_bottom = QSplitter() _layout_bottom.addWidget(self.__wid_run_def) _layout_bottom.addWidget(self.__wid_report_det) # main layout _layout = QVBoxLayout() _layout.addWidget(self.__wid_search_cond) _layout.addWidget(_layout_bottom) _layout.setContentsMargins(0, 0, 0, 0) self.setLayout(_layout) self.__wid_run_def.sig_search.connect(self.search) self.__wid_run_def.sig_selected.connect( self.__wid_report_det.usr_refresh)
def __init__(self): QWidget.__init__(self) self.__x = 0 self.__y = 0 self.__elevation = 0 self.__width = 0 self.__height = 0 self.__opacity = 1.0 self.__clip = None self.__parent_clip = None self.__max_width = 0 self.__max_height = 0 self.__min_width = 0 self.__min_height = 0 self.__max_opacity = 1.0 self.__min_opacity = 0.0 self.__margin_left = 0 self.__margin_top = 0 self.__padding_x = 0 self.__padding_y = 0 self.__fading = False # Defining the layout which will hold the child shapes of the widget self.__layout = QGridLayout() self.__layout.setVerticalSpacing(0) self.__layout.setHorizontalSpacing(0) self.__layout.setContentsMargins(QMargins(0, 0, 0, 0)) self.__children = []
def __init__(self, parent=None): QWidget.__init__(self, parent) self.setupUi(self) self.current_directory = None self.settings = QSettings(QSettings.IniFormat, QSettings.UserScope, COMPANY, APPNAME) self.restoreGeometry(self.settings.value(self.__class__.__name__)) self.splitter.restoreState(self.settings.value(SPLITTER)) self.current_directory = self.settings.value(CURRENT_DIRECTORY) self.white_albatross = WhiteAlbatrossWidget() self.white_albatross.figuresChanged.connect(self.on_figures_changed) self.workLayout.insertWidget(1, self.white_albatross) self.type.currentIndexChanged.connect(self.white_albatross.setType) self.type.setCurrentIndex(int(self.settings.value(LAST_FIGURE_TYPE, defaultValue=0))) self.addImages.clicked.connect(self.add_images_click) self.openFolder.clicked.connect(self.open_folder_clicked) self.removeImages.clicked.connect(self.remove_images) self.imagesList.itemSelectionChanged.connect(self.item_selected) self.deleteFigure.clicked.connect(self.delete_figure) self.figures.customContextMenuRequested.connect(self.figures_context_menu) if self.current_directory: self.open_folder() self.imagesList.setCurrentRow(int(self.settings.value(SELECTED_IMAGE, defaultValue=0)))
def __init__(self): # super(DialogDemo, self).__init__() QWidget.__init__(self) # set the position and size of the window # make it really small, so we don't see this dummy window self.setGeometry(1, 1, 0, 0)
def __init__(self, stepper): QWidget.__init__(self) button_layout = QGridLayout() self.setLayout(button_layout) button_layout.setColumnStretch(0, 0) button_layout.setColumnStretch(1, 0) button_layout.setColumnStretch(3, 0) button_layout.setRowStretch(0, 0) button_layout.setRowStretch(1, 0) button_layout.setRowStretch(3, 0) button_layout.setRowStretch(4, 0) qmy_button(button_layout, stepper.go_to_previous_turn, "pre", the_row=0, the_col=0) qmy_button(button_layout, stepper.go_to_next_turn, "next", the_row=0, the_col=1) qmy_button(button_layout, stepper.insert_before, "ins before", the_row=1, the_col=0) qmy_button(button_layout, stepper.insert_after, "ins after", the_row=1, the_col=1) qmy_button(button_layout, stepper.delete_current_turn, "delete turn", the_row=1, the_col=2) qmy_button(button_layout, stepper.commit, "commit", the_row=2, the_col=0) qmy_button(button_layout, stepper.commit_all, "commit all", the_row=2, the_col=1) qmy_button(button_layout, stepper.revert_current_and_redisplay, "revert", the_row=2, the_col=2) qmy_button(button_layout, stepper.save_file, "save", the_row=3, the_col=0) qmy_button(button_layout, stepper.save_file_as, "save as ...", the_row=3, the_col=1) qmy_button(button_layout, stepper.fill_time_code, "fill time", the_row=4, the_col=0) qmy_button(button_layout, stepper.sync_video, "sync video", the_row=4, the_col=1) button_layout.addWidget(QWidget(), 2, 3) button_layout.addWidget(QWidget(), 5, 0)
def __init__(self, parameter, parent=None): QWidget.__init__(self, parent) self.setAccessibleName(parameter.name) self.setAccessibleDescription(parameter.__doc__.capitalize()) self.setToolTip(parameter.__doc__.capitalize()) self._parameter = parameter self._required = True
def __init__(self): QWidget.__init__(self) vbox = QVBoxLayout() self.setLayout(vbox) self.lst = QListView(self) self.lst.setModel(PersonModel([Person('HZG', 28), Person('ZRH', 21)])) self.lst.clicked.connect(self.printItem) vbox.addWidget(self.lst)
def __init__(self, pushups): ''' Constructor ''' QWidget.__init__(self) self.pushups = pushups self.createGUI()
def __init__(self): QWidget.__init__(self) self.setWindowTitle("Sample Window") self.setGeometry(300, 300, 200, 150) self.setMinimumHeight(100) self.setMinimumWidth(250) self.setMaximumHeight(200) self.setMaximumWidth(800)
def __init__(self, parent): QWidget.__init__(self, parent) self.customWidgets = {'WidgetLedBank': WidgetLedBank} load_ui(self, 'widget_reg.ui') self._widgetLeds.set_led_count(8, Colour.RED)
def __init__(self, parent): self.parent = parent QWidget.__init__(self) self.setAutoFillBackground(True) bgCol = QPalette() bgCol.setColor(QPalette.Background, Qt.yellow) self.setPalette(bgCol) self.initUI()
def __init__(self, icon=None, title=None, text=None, parent=None): QWidget.__init__(self, parent) self.setMouseTracking(True) self.title = title self.icon = icon self.text = text self.setStyleSheet("background-color: rgba(0,0,0,0)") self.press = None
def __init__(self): QWidget.__init__(self) self.setGeometry(QRect(100, 100, 400, 200)) self.layout = QtGui.QGridLayout(self) #lblCorporateEventType self.lblCorporateEventType = QLabel("Type") self.layout.addWidget(self.lblCorporateEventType, 0, 0) #cmbCorporateEventType self.cmbCorporateEventType = QComboBox(self) corporateEventTypeList = DaoCorporateEvent().getCorporateEventTypeList( ) for (corporateEventType) in corporateEventTypeList: self.cmbCorporateEventType.addItem(corporateEventType[1], corporateEventType[0]) self.layout.addWidget(self.cmbCorporateEventType, 0, 1) #lblAssetName self.lblAssetName = QLabel("Asset Name") self.layout.addWidget(self.lblAssetName, 1, 0) #cmdAssetName self.cmdAssetName = QComboBox(self) assetNameList = DaoAsset().getAssetNames('EQUITY') for (assetName) in assetNameList: self.cmdAssetName.addItem(assetName[1], assetName[0]) self.layout.addWidget(self.cmdAssetName, 1, 1) #lblCustody self.lblCustody = QLabel("Custody") self.layout.addWidget(self.lblCustody, 2, 0) #cmbCustody self.cmbCustody = QComboBox(self) custodyList = DaoCustody().getCustodyList() for (row) in custodyList: self.cmbCustody.addItem(row[1], row[0]) self.layout.addWidget(self.cmbCustody, 2, 1) #lblGrossAmount self.lblGrossAmount = QLabel("Gross Amount") self.layout.addWidget(self.lblGrossAmount, 3, 0) #txtGrossAmount self.txtGrossAmount = QLineEdit(self) self.txtGrossAmount.setValidator(QDoubleValidator( 0, 99999999, 6, self)) self.layout.addWidget(self.txtGrossAmount, 3, 1) #lblPaymentDate self.lblPaymentDate = QLabel("Payment Date") self.layout.addWidget(self.lblPaymentDate, 4, 0) #cmbPaymentDate self.cmbPaymentDate = QDateEdit(self) self.cmbPaymentDate.setDisplayFormat("dd-MM-yyyy") self.cmbPaymentDate.setDate(datetime.datetime.now()) self.layout.addWidget(self.cmbPaymentDate, 4, 1) #btnAdd self.btnAdd = QPushButton("Add", self) self.layout.addWidget(self.btnAdd) #btnClear self.btnClear = QPushButton("Clear", self) self.layout.addWidget(self.btnClear) #clearEditor self.clearEditor() self.initListener()
def __init__(self, argv, parentQWidget=None): QWidget.__init__(self) const.mode_interactive = 1 const.mode_file = 2 const.mode_batch = 3 const.mode_default = const.mode_batch arg_file = '' if '-i' in argv: mode = const.mode_interactive elif '-b' in argv: mode = const.mode_batch elif '-f' in argv: mode = const.mode_file idx = argv.index('-f') arg_file = argv[idx + 1] src_path = None if '-s' in argv: idx = argv.index('-s') src_path = argv[idx + 1] if '-c' in argv: idx = argv.index('-c') cfg_file = argv[idx + 1] hbox = QHBoxLayout() vbox = QVBoxLayout() scrollView = ScrollArea() headerView = Header.Header(self) scrollView.connectHeaderView(headerView) headerView.connectMainView(scrollView.mainView.drawer) vbox.addWidget(headerView) vbox.addWidget(scrollView) toolBox = ToolBox.ToolBox(mode) hbox.addLayout(vbox) hbox.addLayout(toolBox) self.controller = Kitchen.Kitchen(mode, arg_file, cfg_file) self.controller.connectView(scrollView.mainView.drawer) self.controller.connectToolBox(toolBox) self.controller.start() srcViewer = SourceViewer.SourceViewer() srcViewer.createIndex(src_path) toolBox.connectMsgRcv(headerView) toolBox.connectMsgRcv(scrollView.mainView.drawer) toolBox.connectMsgRcv(self.controller) toolBox.connectDiagramView(scrollView.mainView.drawer) scrollView.mainView.drawer.setToolBox(toolBox) scrollView.mainView.drawer.connectSourceViewer(srcViewer) self.setLayout(hbox)
def __init__(self, parent=None): QWidget.__init__(self, parent) self.__parent = parent self.setWindowTitle("Calculate Salary") t = datetime.now() self.month = QComboBox() self.month.addItems([ "JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE", "JULY", "AUGUST", "SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER" ]) self.month.setCurrentIndex(t.month - 1) self.year = QSpinBox() self.year.setRange(1900, 3000) self.year.setValue(t.year) self.name = SearchBox(self) self.name.setPlaceholderText("Enter Name") self.name.returnPressed.connect(self.setIDList) self.nameList = [] self.nameList = DatabaseManager.db.getEmployeeNameList() self.name.setList(self.nameList) self.name.setCurrentIndex(-1) self.id = QComboBox() self.id.currentIndexChanged.connect( lambda: self.loadInfo(self.id.currentText())) self.designation = QLineEdit() self.designation.setReadOnly(True) self.originalPay = QLineEdit() self.originalPay.setReadOnly(True) self.originalPayGrade = QLineEdit() self.originalPayGrade.setReadOnly(True) self.DOJ = QLineEdit() self.DOJ.setReadOnly(True) self.pan = QLineEdit() self.pan.setReadOnly(True) self.presentPay = QLineEdit() self.presentPay.setReadOnly(True) self.da_percent = ValueBox() self.hra_percent = ValueBox() self.ta_percent = ValueBox() self.it_percent = ValueBox() self.pt_percent = ValueBox() self.name.editTextChanged.connect(self.clearInfo) self.bttnCalculate = QPushButton("Calculate") self.bttnCalculate.clicked.connect(self.calculate) self.bttnCancel = QPushButton("Back") self.bttnCancel.clicked.connect(self.goBack) self.bttnCalculate.setObjectName("OkButton") self.bttnCancel.setObjectName("CancelButton") self.setupUI()
def __init__(self, parent): QWidget.__init__(self, parent) self.customWidgets = {'WidgetLedBank': WidgetLedBank} load_ui(self, 'widget_ir.ui') self._widgetLedsInst.set_led_count(4, Colour.BLUE) self._widgetLedsData.set_led_count(4, Colour.YELLOW)
def __init__(self, text, validator, minValue, maxValue ): QWidget.__init__( self ) layout = QHBoxLayout( self ) checkBox = QCheckBox() checkBox.setFixedWidth( 115 ) checkBox.setText( text ) layout.addWidget( checkBox ) hLayoutX = QHBoxLayout() lineEditXMin = QLineEdit() lineEditXMax = QLineEdit() hLayoutX.addWidget( lineEditXMin ) hLayoutX.addWidget( lineEditXMax ) lineEditXMin.setValidator( validator ) lineEditXMax.setValidator( validator ) lineEditXMin.setText( str( minValue ) ) lineEditXMax.setText( str( maxValue ) ) layout.addLayout( hLayoutX ) self.checkBox = checkBox self.lineEditX_min = lineEditXMin self.lineEditX_max = lineEditXMax self.lineEdits = [ lineEditXMin, lineEditXMax ] QtCore.QObject.connect( checkBox, QtCore.SIGNAL( "clicked()" ), self.updateEnabled ) self.updateEnabled()
def __init__(self, *args, **kwargs ): QWidget.__init__( self, *args ) self.infoPath = cmds.about(pd=True) + "/sg/fingerWeightCopy/Widget_SelectionGrow.txt" sgCmds.makeFile( self.infoPath ) validator = QIntValidator() layout = QHBoxLayout( self ); layout.setContentsMargins(0,0,0,0) groupBox = QGroupBox() layout.addWidget( groupBox ) hLayout = QHBoxLayout() labelTitle = QLabel( "Grow Selection : " ) buttonGrow = QPushButton( "Grow" ); buttonGrow.setFixedWidth( 50 ) buttonShrink = QPushButton( "Shrink" ); buttonShrink.setFixedWidth( 50 ) lineEdit = QLineEdit(); lineEdit.setValidator( validator );lineEdit.setText( '0' ) hLayout.addWidget( labelTitle ) hLayout.addWidget( buttonGrow ) hLayout.addWidget( buttonShrink ) hLayout.addWidget( lineEdit ) groupBox.setLayout( hLayout ) self.lineEdit = lineEdit QtCore.QObject.connect( buttonGrow, QtCore.SIGNAL("clicked()"), self.growNum ) QtCore.QObject.connect( buttonShrink, QtCore.SIGNAL("clicked()"), self.shrinkNum ) self.vtxLineEditList = [] self.loadInfo()