def setupUi(self, ViewDialog): ViewDialog.setObjectName(_fromUtf8("ViewDialog")) ViewDialog.resize(647, 300) self.buttonBox = QtGui.QDialogButtonBox(ViewDialog) self.buttonBox.setGeometry(QtCore.QRect(30, 250, 341, 32)) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) self.buttonBox.setObjectName(_fromUtf8("buttonBox")) self.calendarWidget = QtGui.QCalendarWidget(ViewDialog) self.calendarWidget.setGeometry(QtCore.QRect(20, 40, 256, 155)) self.calendarWidget.setObjectName(_fromUtf8("calendarWidget")) self.calendarWidget_2 = QtGui.QCalendarWidget(ViewDialog) self.calendarWidget_2.setGeometry(QtCore.QRect(330, 40, 256, 155)) self.calendarWidget_2.setObjectName(_fromUtf8("calendarWidget_2")) self.label = QtGui.QLabel(ViewDialog) self.label.setGeometry(QtCore.QRect(20, 20, 81, 16)) self.label.setObjectName(_fromUtf8("label")) self.label_2 = QtGui.QLabel(ViewDialog) self.label_2.setGeometry(QtCore.QRect(330, 20, 46, 13)) self.label_2.setObjectName(_fromUtf8("label_2")) self.label_incomeType = QtGui.QLabel(ViewDialog) self.label_incomeType.setGeometry(QtCore.QRect(30, 220, 71, 21)) self.label_incomeType.setObjectName(_fromUtf8("label_incomeType")) self.comboBox = QtGui.QComboBox(ViewDialog) self.comboBox.setGeometry(QtCore.QRect(100, 220, 69, 22)) self.comboBox.setEditable(True) self.comboBox.setObjectName(_fromUtf8("comboBox")) self.comboBox.addItem(_fromUtf8("")) self.comboBox.addItem(_fromUtf8("")) self.comboBox.addItem(_fromUtf8("")) self.retranslateUi(ViewDialog) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), ViewDialog.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), ViewDialog.reject) QtCore.QMetaObject.connectSlotsByName(ViewDialog)
def setupUi(self, FireParams): FireParams.setObjectName(_fromUtf8("FireParams")) FireParams.resize(680, 374) self.groupBox = QtGui.QGroupBox(FireParams) self.groupBox.setGeometry(QtCore.QRect(30, 10, 611, 281)) self.groupBox.setTitle(_fromUtf8("")) self.groupBox.setObjectName(_fromUtf8("groupBox")) self.lblLat = QtGui.QLabel(self.groupBox) self.lblLat.setGeometry(QtCore.QRect(20, 20, 51, 16)) self.lblLat.setObjectName(_fromUtf8("lblLat")) self.lblLong = QtGui.QLabel(self.groupBox) self.lblLong.setGeometry(QtCore.QRect(370, 20, 51, 16)) self.lblLong.setObjectName(_fromUtf8("lblLong")) self.latSpinBox = QtGui.QDoubleSpinBox(self.groupBox) self.latSpinBox.setGeometry(QtCore.QRect(80, 20, 111, 22)) self.latSpinBox.setDecimals(3) self.latSpinBox.setMinimum(-180.0) self.latSpinBox.setMaximum(180.0) self.latSpinBox.setObjectName(_fromUtf8("latSpinBox")) self.longSpinBox = QtGui.QDoubleSpinBox(self.groupBox) self.longSpinBox.setGeometry(QtCore.QRect(430, 20, 111, 22)) self.longSpinBox.setDecimals(3) self.longSpinBox.setMinimum(-180.0) self.longSpinBox.setMaximum(180.0) self.longSpinBox.setObjectName(_fromUtf8("longSpinBox")) self.beginCalendarWidget = QtGui.QCalendarWidget(self.groupBox) self.beginCalendarWidget.setGeometry(QtCore.QRect(40, 90, 251, 171)) self.beginCalendarWidget.setMinimumDate(QtCore.QDate(1984, 1, 1)) self.beginCalendarWidget.setMaximumDate(QtCore.QDate(2035, 12, 31)) self.beginCalendarWidget.setVerticalHeaderFormat(QtGui.QCalendarWidget.NoVerticalHeader) self.beginCalendarWidget.setObjectName(_fromUtf8("beginCalendarWidget")) self.lblBeginDate = QtGui.QLabel(self.groupBox) self.lblBeginDate.setGeometry(QtCore.QRect(40, 60, 81, 16)) self.lblBeginDate.setObjectName(_fromUtf8("lblBeginDate")) self.endCalendarWidget = QtGui.QCalendarWidget(self.groupBox) self.endCalendarWidget.setGeometry(QtCore.QRect(310, 90, 251, 171)) self.endCalendarWidget.setMinimumDate(QtCore.QDate(1984, 1, 1)) self.endCalendarWidget.setMaximumDate(QtCore.QDate(2035, 12, 31)) self.endCalendarWidget.setVerticalHeaderFormat(QtGui.QCalendarWidget.NoVerticalHeader) self.endCalendarWidget.setObjectName(_fromUtf8("endCalendarWidget")) self.lblEndDate = QtGui.QLabel(self.groupBox) self.lblEndDate.setGeometry(QtCore.QRect(320, 60, 81, 16)) self.lblEndDate.setObjectName(_fromUtf8("lblEndDate")) self.okButton = QtGui.QPushButton(FireParams) self.okButton.setGeometry(QtCore.QRect(110, 310, 93, 28)) self.okButton.setObjectName(_fromUtf8("okButton")) self.cancelButton = QtGui.QPushButton(FireParams) self.cancelButton.setGeometry(QtCore.QRect(360, 310, 93, 28)) self.cancelButton.setObjectName(_fromUtf8("cancelButton")) self.retranslateUi(FireParams) QtCore.QObject.connect(self.cancelButton, QtCore.SIGNAL(_fromUtf8("clicked()")), FireParams.close) QtCore.QMetaObject.connectSlotsByName(FireParams)
def setupUi(self, song_usage_detail_dialog): """ Set up the UI :param song_usage_detail_dialog: """ song_usage_detail_dialog.setObjectName('song_usage_detail_dialog') song_usage_detail_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg')) song_usage_detail_dialog.resize(609, 413) self.vertical_layout = QtGui.QVBoxLayout(song_usage_detail_dialog) self.vertical_layout.setSpacing(8) self.vertical_layout.setContentsMargins(8, 8, 8, 8) self.vertical_layout.setObjectName('vertical_layout') self.date_range_group_box = QtGui.QGroupBox(song_usage_detail_dialog) self.date_range_group_box.setObjectName('date_range_group_box') self.date_horizontal_layout = QtGui.QHBoxLayout(self.date_range_group_box) self.date_horizontal_layout.setSpacing(8) self.date_horizontal_layout.setContentsMargins(8, 8, 8, 8) self.date_horizontal_layout.setObjectName('date_horizontal_layout') self.from_date_calendar = QtGui.QCalendarWidget(self.date_range_group_box) self.from_date_calendar.setObjectName('from_date_calendar') self.date_horizontal_layout.addWidget(self.from_date_calendar) self.to_label = QtGui.QLabel(self.date_range_group_box) self.to_label.setScaledContents(False) self.to_label.setAlignment(QtCore.Qt.AlignCenter) self.to_label.setObjectName('to_label') self.date_horizontal_layout.addWidget(self.to_label) self.to_date_calendar = QtGui.QCalendarWidget(self.date_range_group_box) self.to_date_calendar.setObjectName('to_date_calendar') self.date_horizontal_layout.addWidget(self.to_date_calendar) self.vertical_layout.addWidget(self.date_range_group_box) self.file_group_box = QtGui.QGroupBox(self.date_range_group_box) self.file_group_box.setObjectName('file_group_box') self.file_horizontal_layout = QtGui.QHBoxLayout(self.file_group_box) self.file_horizontal_layout.setSpacing(8) self.file_horizontal_layout.setContentsMargins(8, 8, 8, 8) self.file_horizontal_layout.setObjectName('file_horizontal_layout') self.file_line_edit = QtGui.QLineEdit(self.file_group_box) self.file_line_edit.setObjectName('file_line_edit') self.file_line_edit.setReadOnly(True) self.file_horizontal_layout.addWidget(self.file_line_edit) self.save_file_push_button = QtGui.QPushButton(self.file_group_box) self.save_file_push_button.setMaximumWidth(self.save_file_push_button.size().height()) self.save_file_push_button.setIcon(build_icon(':/general/general_open.png')) self.save_file_push_button.setObjectName('save_file_push_button') self.file_horizontal_layout.addWidget(self.save_file_push_button) self.vertical_layout.addWidget(self.file_group_box) self.button_box = create_button_box(song_usage_detail_dialog, 'button_box', ['cancel', 'ok']) self.vertical_layout.addWidget(self.button_box) self.retranslateUi(song_usage_detail_dialog) self.save_file_push_button.clicked.connect(song_usage_detail_dialog.define_output_location)
def setupUi(self, Frame): Frame.setObjectName(_fromUtf8("Frame")) Frame.resize(800, 480) Frame.setFrameShape(QtGui.QFrame.StyledPanel) Frame.setFrameShadow(QtGui.QFrame.Raised) self.label = QtGui.QLabel(Frame) self.label.setGeometry(QtCore.QRect(98, 104, 91, 31)) self.label.setObjectName(_fromUtf8("label")) self.lcdNumber = QtGui.QLCDNumber(Frame) self.lcdNumber.setGeometry(QtCore.QRect(253, 92, 121, 41)) self.lcdNumber.setObjectName(_fromUtf8("lcdNumber")) self.calendarWidget = QtGui.QCalendarWidget(Frame) self.calendarWidget.setGeometry(QtCore.QRect(460, 40, 272, 165)) self.calendarWidget.setObjectName(_fromUtf8("calendarWidget")) self.graphicsView = QtGui.QGraphicsView(Frame) self.graphicsView.setGeometry(QtCore.QRect(470, 230, 256, 192)) self.graphicsView.setObjectName(_fromUtf8("graphicsView")) self.lcdNumber_2 = QtGui.QLCDNumber(Frame) self.lcdNumber_2.setGeometry(QtCore.QRect(255, 250, 121, 41)) self.lcdNumber_2.setObjectName(_fromUtf8("lcdNumber_2")) self.label_2 = QtGui.QLabel(Frame) self.label_2.setGeometry(QtCore.QRect(100, 262, 91, 31)) self.label_2.setObjectName(_fromUtf8("label_2")) self.textBrowser = QtGui.QTextBrowser(Frame) self.textBrowser.setGeometry(QtCore.QRect(120, 320, 256, 111)) self.textBrowser.setObjectName(_fromUtf8("textBrowser")) self.retranslateUi(Frame) QtCore.QMetaObject.connectSlotsByName(Frame)
def setupUi(self, Question2): Question2.setObjectName(_fromUtf8("Question2")) Question2.resize(340, 310) self.CalendarWidget = QtGui.QCalendarWidget(Question2) self.CalendarWidget.setGeometry(QtCore.QRect(10, 40, 321, 191)) self.CalendarWidget.setObjectName(_fromUtf8("CalendarWidget")) self.TitleLbl = QtGui.QLabel(Question2) self.TitleLbl.setGeometry(QtCore.QRect(10, 10, 321, 16)) self.TitleLbl.setObjectName(_fromUtf8("TitleLbl")) self.CalculateBtn = QtGui.QPushButton(Question2) self.CalculateBtn.setGeometry(QtCore.QRect(10, 240, 81, 31)) self.CalculateBtn.setObjectName(_fromUtf8("CalculateBtn")) self.DaysRemainingTxt = QtGui.QLabel(Question2) self.DaysRemainingTxt.setGeometry(QtCore.QRect(100, 240, 231, 31)) self.DaysRemainingTxt.setObjectName(_fromUtf8("DaysRemainingTxt")) self.label = QtGui.QLabel(Question2) self.label.setGeometry(QtCore.QRect(220, 270, 111, 21)) self.label.setObjectName(_fromUtf8("label")) self.label_2 = QtGui.QLabel(Question2) self.label_2.setGeometry(QtCore.QRect(270, 290, 61, 16)) self.label_2.setObjectName(_fromUtf8("label_2")) self.retranslateUi(Question2) QtCore.QObject.connect(self.CalendarWidget, QtCore.SIGNAL(_fromUtf8("selectionChanged()")), self.CalculateBtn.toggle) QtCore.QMetaObject.connectSlotsByName(Question2)
def __init__(self, window, uaserver, parent=None): super(V_historial, self).__init__(window) self.window = window self.uaserver = uaserver self.model = QStandardItemModel() self.setWindowTitle("SERVIDOR OPCUA - HISTORIAL") self.resize(600, 450) #Tamaño inicial self.setMaximumSize(800, 600) self.layout = QGridLayout() #Crear un layout grid self.setLayout(self.layout) #Agregar el layout al cuadro de diálogo self.table = QTableWidget() #Crear la tabla #Define el calendario en una ventana self.cal = QtGui.QCalendarWidget(self) #Se define una cuadricula al calendario self.cal.setGridVisible(True) #Se define una etiqueta donde se mostrara la fecha seleccionada self.etiqueta = QtGui.QLabel(self) #Se define como empaquetar los widgets. #En este caso se usa grilla. #Se crea la instancia self.layout.setSpacing(25) self.layout.setColumnStretch(1, 500) self.layout.setColumnMinimumWidth(1, 400) self.table.clear() self.layout.addWidget(self.table, 1, 1) #Agregar la tabla al layout self.layout.addWidget(self.cal, 1, 0) #Agregar el calendario al layout self.layout.addWidget(self.etiqueta, 2, 0) #Agregar la etiqueta al layout self.table.setColumnCount(4)
def __init__(self, Parent): QtGui.QDialog.__init__(self, Parent) self.setWindowTitle(d2u('Календар')) self.setWindowIcon(QtGui.QIcon("static/icons/Add.ico")) self.resize(300, 100) vbox = QtGui.QVBoxLayout() self.cal = QtGui.QCalendarWidget() vbox.addWidget(self.cal) self.buttonOK = QtGui.QPushButton(d2u("Изврши")) self.connect(self.buttonOK, QtCore.SIGNAL("clicked()"), self.OKClicked) self.buttonCancel = QtGui.QPushButton(d2u("Излез")) self.connect(self.buttonCancel, QtCore.SIGNAL("clicked()"), self.reject) OKCancelLayout = QtGui.QHBoxLayout() OKCancelLayout.addStretch() OKCancelLayout.addWidget(self.buttonOK) OKCancelLayout.addWidget(self.buttonCancel) vbox.addLayout(OKCancelLayout) self.setLayout(vbox) self.selectedDate = self.cal.selectedDate()
def creerFormulaire(self): """On créer les éléments du formulaire""" formulaire = QtGui.QFormLayout() depart = QtGui.QLineEdit() destination = QtGui.QLineEdit() date = QtGui.QCalendarWidget() ranges = QtGui.QComboBox(self) for i in range(10, 31): ranges.addItem(str(i)) sieges = QtGui.QComboBox(self) for i in range(2, 7): sieges.addItem(str(i)) #On ajoute dans un formLayout formulaire.addRow(u"Départ", depart) formulaire.addRow(u"Destination", destination) formulaire.addRow(u"Date", date) formulaire.addRow(u"Rangés", ranges) formulaire.addRow(u"Sièges", sieges) return formulaire
def set_calendar(self, QDateEdit): calendar_widget = QtGui.QCalendarWidget() calendar_widget.showToday() #calendar_widget.setStyleSheet("background-color: white;") QDateEdit.setCalendarPopup(True) QDateEdit.setCalendarWidget(calendar_widget) QDateEdit.dateChanged.connect(self.update_tasks)
def Calendar(): cal = QtGui.QCalendarWidget() cal.setGridVisible(True) cal.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates)) cal.setFirstDayOfWeek(QtCore.Qt.Monday) cal.setHorizontalHeaderFormat(QtGui.QCalendarWidget.ShortDayNames) return cal
def setupUi(self, calenderDialog): calenderDialog.setObjectName(_fromUtf8("calenderDialog")) calenderDialog.resize(400, 440) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( calenderDialog.sizePolicy().hasHeightForWidth()) calenderDialog.setSizePolicy(sizePolicy) calenderDialog.setMinimumSize(QtCore.QSize(400, 440)) calenderDialog.setMaximumSize(QtCore.QSize(400, 440)) calenderDialog.setContextMenuPolicy(QtCore.Qt.NoContextMenu) calenderDialog.setStyleSheet( _fromUtf8( "#calenderDialog{background-color:white;}\n" "\n" "#calenderclose{border-radius:15px;border:none;background-color: rgb(0,120,215);}\n" "\n" "#calenderclose:hover{background-color: #ccc;}")) calenderDialog.setSizeGripEnabled(True) self.calendarWidget = QtGui.QCalendarWidget(calenderDialog) self.calendarWidget.setGeometry(QtCore.QRect(0, 40, 400, 400)) self.calendarWidget.setObjectName(_fromUtf8("calendarWidget")) self.widget = QtGui.QWidget(calenderDialog) self.widget.setGeometry(QtCore.QRect(0, 0, 401, 40)) self.widget.setStyleSheet( _fromUtf8("background-color: rgb(66, 74, 89);")) self.widget.setObjectName(_fromUtf8("widget")) self.calenderMin = QtGui.QPushButton(self.widget) self.calenderMin.setGeometry(QtCore.QRect(340, 10, 20, 20)) self.calenderMin.setToolTip(_fromUtf8("")) self.calenderMin.setStyleSheet( _fromUtf8("#calenderMin{\n" "background-color:rgb(255,224,81);\n" " border-radius:10px;}\n" "#calenderMin:hover{\n" "border-image: url(:/souce/souce/最小化.png);\n" "}\n" "")) self.calenderMin.setText(_fromUtf8("")) self.calenderMin.setObjectName(_fromUtf8("calenderMin")) self.calenderClose = QtGui.QPushButton(self.widget) self.calenderClose.setGeometry(QtCore.QRect(370, 10, 20, 20)) self.calenderClose.setStyleSheet( _fromUtf8( "#calenderClose{\n" " background-color:tomato;\n" " border-radius:10px;}\n" "#calenderClose:hover{border-image: url(:/souce/souce/关闭1.png);}\n" "")) self.calenderClose.setText(_fromUtf8("")) self.calenderClose.setObjectName(_fromUtf8("calenderClose")) self.label = QtGui.QLabel(self.widget) self.label.setGeometry(QtCore.QRect(140, 0, 101, 41)) self.label.setStyleSheet(_fromUtf8("color:white;")) self.label.setObjectName(_fromUtf8("label")) self.retranslateUi(calenderDialog) QtCore.QMetaObject.connectSlotsByName(calenderDialog)
def switchAction(self): if self.stack.currentIndex() == 0: self.cal = QtGui.QCalendarWidget() self.stack.addWidget(self.cal) self.stack.setCurrentIndex(1) else: self.stack.removeWidget(self.cal)
def __init__(self, parent = None): QtGui.QWidget.__init__(self, parent) self.calendar = QtGui.QCalendarWidget() self.calendar.setFirstDayOfWeek(QtCore.Qt.Monday) self.calendar.setVerticalHeaderFormat(self.calendar.NoVerticalHeader) self.calendar.setMaximumSize(self.calendar.minimumSizeHint()) self.combo_box = QtGui.QComboBox(self) self.combo_box.addItems([_("Day"),_("Four Days"), _("Week"), _("Fortnight"), _("Month"), _("Year"), _("List"), ("Tasks")]) #: self.diary_schedule_controller = DiaryScheduleController() #: self.diary_view_controller = DiaryViewController() layout = QtGui.QVBoxLayout(self) layout.setMargin(PADDING) layout.addWidget(self.combo_box) layout.addWidget(self.calendar) layout.addWidget(self.diary_schedule_controller) layout.addWidget(self.diary_view_controller) self.setMaximumWidth(self.calendar.width()+ PADDING*2) self.calendar.selectionChanged.connect(self.date_change) self.combo_box.currentIndexChanged.connect(self.view_change)
def build(self, n=3, columns=3, year=None, month=None): self.calendars = [] if year is None: year = datetime.date.today().year if month is None: month = datetime.date.today().month layout = QtGui.QGridLayout() while self.layout().count(): self.layout().removeItem(self.layout().itemAt(0)) self.layout().addLayout(layout) size = self.minimumSizeHint() x, y = size.width(), size.height() x *= min(n, columns) y *= 1 + ((n - 1) // columns) self.setMinimumSize(QtCore.QSize(x, y)) for i in range(n): calendar = QtGui.QCalendarWidget() calendar.i = i calendar.setCurrentPage(year, month) month += 1 if month == 13: year += 1 month = 1 calendar.currentPageChanged.connect( lambda year, month, cal=calendar: self.currentPageChanged( year, month, cal)) calendar.clicked.connect(self.return_result) calendar.activated.connect(self.return_result) self.calendars.append(calendar) layout.addWidget(calendar, i // columns, i % columns)
def __init__(self, parent = None): QtGui.QWidget.__init__(self, parent) self.setGeometry(800, 300, 800, 600) self.setWindowTitle(u'模型工具自动化生成正负面报告') self.setWindowIcon(QtGui.QIcon('timg.jpg')) background = QtGui.QPixmap('background.jpg') palette = QtGui.QPalette() palette.setBrush(self.backgroundRole(), QtGui.QBrush(background)) # 添加背景图片 self.setPalette(palette) # self.output = QtGui.QPushButton(u'选择日期', self) # self.output.setGeometry(300, 90, 200, 70) self.cal = QtGui.QCalendarWidget(self) # self.cal.setGridVisible(True) self.cal.setGeometry(250, 50, 300, 180) self.connect(self.cal, QtCore.SIGNAL('selectionChanged()'), self.select) self.output = QtGui.QPushButton(u'一键导出', self) self.output.setGeometry(300, 230, 200, 70) self.output.clicked.connect(self.button) self.back = QtGui.QPushButton(u'后退', self) self.back.setGeometry(20, 20, 60, 40) self.back.clicked.connect(self.backbutton) self.mysql_conn = MySQLdb.connect(host="192.168.30.2", user='******', passwd='zsce188xa5', db='yqht', charset='utf8') self.mysql_cursor = self.mysql_conn.cursor() self.document = Document() self.today = ''
def __init__(self, title="Calendar"): super(CalendarWidget, self).__init__() self.setWindowTitle(title) layout = QtGui.QGridLayout() layout.setColumnStretch(1, 1) self.cal = QtGui.QCalendarWidget(self) self.cal.setGridVisible(True) self.cal.clicked[QtCore.QDate].connect(self.show_date) layout.addWidget(self.cal, 0, 0, 1, 2) self.date_label = QtGui.QLabel() self.date = self.cal.selectedDate() self.date_label.setText(self.date.toString()) layout.addWidget(self.date_label, 1, 0) button_box = QtGui.QDialogButtonBox() confirm_button = button_box.addButton(QtGui.QDialogButtonBox.Ok) confirm_button.clicked.connect(self.confirm) layout.addWidget(button_box, 1, 1) self.setLayout(layout) self.show() self.raise_()
def home(self): btn = QtGui.QPushButton("Quit", self) btn.clicked.connect(self.close_application) ## btn.resize(100,100) btn.resize(btn.sizeHint()) #btn.resize(btn.minimumSizeHint()) btn.move(100, 100) # tool bar: extractAction = QtGui.QAction(QtGui.QIcon('KawsMiffy.png'), 'Flee the Scene', self) extractAction.triggered.connect(self.close_application) self.toolBar = self.addToolBar("Extraction") self.toolBar.addAction(extractAction) # font choice: fontChoice = QtGui.QAction('Font', self) fontChoice.triggered.connect(self.font_choice) self.toolBar = self.addToolBar("Font") self.toolBar.addAction(fontChoice) # color picker: color = QtGui.QColor(0, 0, 0) fontColor = QtGui.QAction('Font bg Color', self) fontColor.triggered.connect(self.color_picker) self.toolBar.addAction(fontColor) # check box: checkBox = QtGui.QCheckBox('Enlarge Window', self) checkBox.move(300, 25) '''checkBox.toggle() by default set it to be toggled''' checkBox.stateChanged.connect(self.enlarge_window) # progress bar: self.progress = QtGui.QProgressBar(self) self.progress.setGeometry(200, 80, 250, 20) self.btn = QtGui.QPushButton("Download", self) self.btn.move(200, 120) self.btn.clicked.connect(self.download) # drop down menu and style toolbar: print(self.style().objectName()) self.styleChoice = QtGui.QLabel("Windows Vista", self) comboBox = QtGui.QComboBox(self) comboBox.addItem("motif") comboBox.addItem("Windows") comboBox.addItem("cde") comboBox.addItem("Plastique") comboBox.addItem("Cleanlooks") comboBox.addItem("windowvista") comboBox.move(50, 250) self.styleChoice.move(50, 150) comboBox.activated[str].connect(self.style_choice) # calender: cal = QtGui.QCalendarWidget(self) cal.move(500, 200) cal.resize(200, 200) self.show()
def addCalendar(self): d = QtGui.QDockWidget() d.setWindowTitle("Calendar") c = QtGui.QCalendarWidget() d.setWidget(c) self.mw.addDockWidget(QtCore.Qt.RightDockWidgetArea, d) self.dock[d] = c
def setupUi(self, song_usage_delete_dialog): """ Setup the UI :param song_usage_delete_dialog: """ song_usage_delete_dialog.setObjectName('song_usage_delete_dialog') song_usage_delete_dialog.setWindowIcon( build_icon(u':/icon/openlp-logo.svg')) song_usage_delete_dialog.resize(291, 243) self.vertical_layout = QtGui.QVBoxLayout(song_usage_delete_dialog) self.vertical_layout.setSpacing(8) self.vertical_layout.setContentsMargins(8, 8, 8, 8) self.vertical_layout.setObjectName('vertical_layout') self.delete_label = QtGui.QLabel(song_usage_delete_dialog) self.delete_label.setObjectName('delete_label') self.vertical_layout.addWidget(self.delete_label) self.delete_calendar = QtGui.QCalendarWidget(song_usage_delete_dialog) self.delete_calendar.setFirstDayOfWeek(QtCore.Qt.Sunday) self.delete_calendar.setGridVisible(True) self.delete_calendar.setVerticalHeaderFormat( QtGui.QCalendarWidget.NoVerticalHeader) self.delete_calendar.setObjectName('delete_calendar') self.vertical_layout.addWidget(self.delete_calendar) self.button_box = create_button_box(song_usage_delete_dialog, 'button_box', ['cancel', 'ok']) self.vertical_layout.addWidget(self.button_box) self.retranslateUi(song_usage_delete_dialog)
def home(self): btn = QtGui.QPushButton("Quit", self) btn.clicked.connect(self.close_application) btn.resize(btn.minimumSizeHint()) btn.move(0,100) extractAction = QtGui.QAction('Extraction',self) extractAction.triggered.connect(self.close_application) self.toolBar =self.addToolBar("Extraction") self.toolBar.addAction(extractAction) #Font Widget fontChoice = QtGui.QAction('Font',self) fontChoice.triggered.connect(self.font_choice) #self.toolBar =self.addToolBar("Font") self.toolBar.addAction(fontChoice) #Checkbox checkBox = QtGui.QCheckBox("Enlarge Window", self) checkBox.move(300,30) #checkBox.toggle() is used when you want to automatically check the box checkBox.stateChanged.connect(self.enlarge_window) #progressBar self.progress =QtGui.QProgressBar(self) self.progress.setGeometry(200,80,250,20) self.btn =QtGui.QPushButton("Download",self) self.btn.move(200,120) self.btn.clicked.connect(self.download) #Drop down and Styles self.styleChoice = QtGui.QLabel("Wndows vista", self) comboBox =QtGui.QComboBox(self) comboBox.addItem("motif") comboBox.addItem("Cleanlooks") comboBox.addItem("Windows") comboBox.move(50,250) self.styleChoice.move(50,150) comboBox.activated[str].connect(self.style_choice) #Font Colors #color = QtGui.QColor(0,0,0) fontColor = QtGui.QAction('Font BG Color', self) fontColor.triggered.connect(self.color_picker) self.toolBar.addAction(fontColor) #Add Calendar cal =QtGui.QCalendarWidget(self) cal.move(500,200) cal.resize(200,200) self.show()
def home(self): # btn = QtGui.QPushButton("Quit button", self) # btn.clicked.connect(self.close_application) # btn.resize(btn.minimumSizeHint()) # btn.move(450, 270) btn = QtGui.QPushButton("Run", self) btn.clicked.connect(self.close_application) btn.resize(btn.minimumSizeHint()) btn.move(450, 270) extractAction = QtGui.QAction(QtGui.QIcon(), 'Quit', self) extractAction.triggered.connect(self.close_application) self.toolBar = self.addToolBar("Extraction") self.toolBar.addAction(extractAction) fontChoice = QtGui.QAction('Font', self) fontChoice.triggered.connect(self.font_choice) self.toolBar = self.addToolBar("Font") self.toolBar.addAction(fontChoice) color = QtGui.QColor(0, 0, 0) fontColor = QtGui.QAction('Font bg Color', self) fontColor.triggered.connect(self.color_picker) self.toolBar.addAction(fontColor) checkBox = QtGui.QCheckBox('Enlarge Window', self) checkBox.move(100, 50) checkBox.stateChanged.connect(self.enlarge_window) self.progress = QtGui.QProgressBar(self) self.progress.setGeometry(200, 80, 250, 20) self.btn = QtGui.QPushButton("Download", self) self.btn.move(200, 120) self.btn.clicked.connect(self.download) #print(self.style().objectName()) self.styleChoice = QtGui.QLabel("Windows Vista", self) comboBox = QtGui.QComboBox(self) comboBox.addItem("motif") comboBox.addItem("Windows") comboBox.addItem("cde") comboBox.addItem("Plastique") comboBox.addItem("Cleanlooks") comboBox.addItem("Windowsvista") comboBox.move(50, 250) self.styleChoice.move(50, 150) comboBox.activated[str].connect(self.style_choice) cal = QtGui.QCalendarWidget(self) cal.move(500, 200) cal.resize(200, 200) self.show()
def elements(self): #Dieses Objekt enhält alle Steuerelemente der Software. '''Es sind enthalten: - Kilometerstand* - Datum * - Preis * - Preis pro Liter * - Typ Die mit Stern markierten Elemente müssen bei Eintrag in die Datenbank vorhanden sein ''' vertikalerAbstand = 40 #Kilometerstand self.lineInKilometerstand = QtGui.QLineEdit(self) self.lineInKilometerstand.move(50, 10) self.lineInKilometerstand.resize(200, 30) self.lineInKilometerstand.setPlaceholderText("Kilometerstand") self.lineInKilometerstand.setValidator( QtGui.QIntValidator(0, 1000000, self)) self.lineInKilometerstand.editingFinished.connect(self.textAngepasst) #Datum self.lineInDatum = QtGui.QCalendarWidget(self) #self.lineInDatum.setFirstDayOfWeek(self, QtDayOfWeek=1) self.lineInDatum.setGridVisible(True) #self.lineInDatum = QtGui.QLineEdit(self) self.lineInDatum.move(300, 10) self.lineInDatum.resize(200, 30) #self.lineInDatum.setPlaceholderText("Datum") ''' !!!!Das Datum kann aktuell auch falsch eingelesen werden! Es findet keine Filterung statt!!! ''' #lineInDatum.setValidator(QtGui.QIntValidator(0, 100000, self)) #QtGui.QRegExpValidator("(0[1-9]|[12][0-9]|3[01])/(0[1-9]|[1][0-2])/(19[0-9][0-9]|20[0-9][0-9])") #Preis self.lineInPreis = QtGui.QLineEdit(self) self.lineInPreis.move(50, 10 + (1 * vertikalerAbstand)) self.lineInPreis.resize(200, 30) self.lineInPreis.setPlaceholderText("Betrag gezahlt") #Preis pro Liter self.lineInGrundpreis = QtGui.QLineEdit(self) self.lineInGrundpreis.move(50, 10 + (2 * vertikalerAbstand)) self.lineInGrundpreis.resize(200, 30) self.lineInGrundpreis.setPlaceholderText("Grundpreis in €/l") self.btnSchreibeDB = QtGui.QPushButton("Schreibe in DB", self) self.btnSchreibeDB.clicked.connect(self.schreibeDatenbank) self.btnSchreibeDB.move(50, 10 + (4 * vertikalerAbstand)) self.btnSchreibeDB.resize(150, 30) #Button zum Lesen der DB Daten self.btnLeseDB = QtGui.QPushButton("Lese DB", self) self.btnLeseDB.clicked.connect(self.schreibeDatenbank) self.btnLeseDB.move(50, 10 + (5 * vertikalerAbstand)) self.btnLeseDB.resize(150, 30) self.show()
def home(self): btn = QtGui.QPushButton("Quit", self) btn.clicked.connect(self.close_application) btn.resize(btn.sizeHint()) # more preferable auto adjusting # btn.resize(btn.minimumSizeHint()) btn.move(0, 100) #position # ToolBar extractAction = QtGui.QAction(QtGui.QIcon('todachoppa.png'), 'This is exit', self) extractAction.triggered.connect(self.close_application) # extractAction.triggered.connect(self.close_application()) # the paranthesis would load the method in the memory and runs it immediately, thus the application closes itself again and again self.toolBar = self.addToolBar("Extraction") self.toolBar.addAction(extractAction) fontChoice = QtGui.QAction('Font', self) fontChoice.triggered.connect(self.font_choice) # self.toolBar = self.addToolBar("Font") self.toolBar.addAction(fontChoice) color = QtGui.QColor(0, 0, 0) fontColor = QtGui.QAction('Font BG Color', self) fontColor.triggered.connect(self.color_picker) self.toolBar.addAction(fontColor) checkBox = QtGui.QCheckBox('Enlarge Window', self) checkBox.move(300, 25) # checkBox.toggle() checkBox.stateChanged.connect(self.enlarge_window) self.progress = QtGui.QProgressBar(self) self.progress.setGeometry(200, 80, 250, 20) self.btn = QtGui.QPushButton("Download", self) self.btn.move(200, 120) self.btn.clicked.connect(self.download) print(self.style().objectName()) self.styleChoice = QtGui.QLabel("Windows Vista", self) comboBox = QtGui.QComboBox(self) comboBox.addItem("motif") comboBox.addItem("Windows") comboBox.addItem("cde") comboBox.addItem("Plastique") comboBox.addItem("Cleanlooks") comboBox.addItem("windowsvista") comboBox.move(50, 250) self.styleChoice.move(50, 150) comboBox.activated[str].connect(self.style_choice) cal = QtGui.QCalendarWidget(self) cal.move(200, 200) cal.resize(200, 200) self.show()
def home(self): boton = QtGui.QPushButton('Quit', self) boton.clicked.connect(self.closeApplication) boton.resize(100, 100) #boton.minimumSizeHint() boton.move(100, 100) otraAction = QtGui.QAction(QtGui.QIcon('logoBueno.png'), 'Flee', self) otraAction.triggered.connect(self.closeApplication) self.toolBar = self.addToolBar('Extracition') self.toolBar.addAction(otraAction) # Font fontChoice = QtGui.QAction('Fonty', self) fontChoice.triggered.connect(self.seleccionFuente) #self.toolBar = self.addToolBar('Font') # Crear otra barra o hacer todo en una self.toolBar.addAction(fontChoice) # Colour color = QtGui.QColor(0, 0, 0) fontColor = QtGui.QAction('Accion para el color', self) fontColor.triggered.connect(self.seleccionColor) self.toolBar.addAction(fontColor) checkBox = QtGui.QCheckBox('Alargar Ventana', self) checkBox.move(100, 100) checkBox.toggle() checkBox.stateChanged.connect(self.alargarVentana) self.progress = QtGui.QProgressBar(self) self.progress.setGeometry(200, 80, 250, 20) self.miBoton = QtGui.QPushButton('Descargar', self) self.miBoton.move(200, 120) self.miBoton.clicked.connect(self.download) print(self.style().objectName()) self.styleChoice = QtGui.QLabel('Windows', self) comboBox = QtGui.QComboBox(self) comboBox.addItem('motif') comboBox.addItem('Windows') comboBox.addItem('cde') comboBox.addItem('Plastique') comboBox.addItem('Cleanlooks') comboBox.addItem('windowsvista') comboBox.move(50, 250) self.styleChoice.move(50, 150) comboBox.activated[str].connect(self.style_choice) calendario = QtGui.QCalendarWidget(self) calendario.move(200, 120) calendario.resize(200, 200) self.show()
def __init__(self, parent=None): """ UI central constructor :param parent: """ super(UI_central, self).__init__(parent) # Create label, textedit, calendar and pushbutton. self.label1 = QtGui.QLabel("Stock:") self.text1 = QtGui.QLineEdit() self.label2 = QtGui.QLabel("How many?") self.text2 = QtGui.QLineEdit() self.calendar = QtGui.QCalendarWidget() self.button = QtGui.QPushButton("Add") # Create a first HBoxLayout and add above each element in order. hbox = QtGui.QHBoxLayout() hbox.addWidget(self.label1) hbox.addWidget(self.text1) hbox.addWidget(self.label2) hbox.addWidget(self.text2) hbox.addWidget(self.calendar) hbox.addWidget(self.button) # Create label, combobox and pushbutton. self.label3 = QtGui.QLabel("Known Stocks") self.combobox = QtGui.QComboBox() self.button1 = QtGui.QPushButton("Display Officers") # Create a second HBoxLayout and add above each element in order. hbox1 = QtGui.QHBoxLayout() hbox1.addWidget(self.label3) hbox1.addWidget(self.combobox) hbox1.addWidget(self.button1) # Create label and textedit. self.label4 = QtGui.QLabel("Officers and Directors") self.text3 = QtGui.QTextEdit() # Create a third HBoxLayout and add above each element in order. hbox2 = QtGui.QHBoxLayout() hbox2.addWidget(self.label4) hbox2.addWidget(self.text3) # Create a VBoxLayout element and all three hbox to the vbox. vbox = QtGui.QVBoxLayout() vbox.addLayout(hbox) vbox.addLayout(hbox1) vbox.addLayout(hbox2) self.widget = QtGui.QWidget(self) # Create an instance of QtMpl class and add it to vbox self.mpl = QtMpl.QtMpl(self.widget) vbox.addWidget(self.mpl) self.setLayout(vbox)
def __init__(self, default=None): super(CalendarValidateWidget, self).__init__() self.addButton("Cancel", QtGui.QMessageBox.RejectRole) self.addButton("OK", QtGui.QMessageBox.AcceptRole) self._lay = self.layout() self._calendar = QtGui.QCalendarWidget() if default: self._calendar.setSelectedDate(default) self._lay.addWidget(self._calendar, 0, 0)
def __init__(self, parent=None, editable=True, nullable=True, **kwargs): CustomEditor.__init__(self, parent) self.date_format = local_date_format() self.line_edit = DecoratedLineEdit() self.line_edit.set_background_text( QtCore.QDate(2000,1,1).toString(self.date_format) ) # The order of creation of this widgets and their parenting # seems very sensitive under windows and creates system crashes # so don't change this without extensive testing on windows special_date_menu = QtGui.QMenu(self) calendar_widget_action = QtGui.QWidgetAction(special_date_menu) self.calendar_widget = QtGui.QCalendarWidget(special_date_menu) self.calendar_widget.activated.connect(self.calendar_widget_activated) self.calendar_widget.clicked.connect(self.calendar_widget_activated) calendar_widget_action.setDefaultWidget(self.calendar_widget) self.calendar_action_trigger.connect( special_date_menu.hide ) special_date_menu.addAction(calendar_widget_action) special_date_menu.addAction(_('Today')) special_date_menu.addAction(_('Far future')) self.special_date = QtGui.QToolButton(self) self.special_date.setIcon( self.special_date_icon.getQIcon() ) self.special_date.setAutoRaise(True) self.special_date.setToolTip(_('Calendar and special dates')) self.special_date.setMenu(special_date_menu) self.special_date.setPopupMode(QtGui.QToolButton.InstantPopup) self.special_date.setFixedHeight(self.get_height()) self.special_date.setFocusPolicy(Qt.ClickFocus) # end of sensitive part if nullable: special_date_menu.addAction(_('Clear')) self.hlayout = QtGui.QHBoxLayout() self.hlayout.addWidget(self.line_edit) self.hlayout.addWidget(self.special_date) self.hlayout.setContentsMargins(0, 0, 0, 0) self.hlayout.setMargin(0) self.hlayout.setSpacing(0) self.hlayout.setAlignment(Qt.AlignRight|Qt.AlignVCenter) self.setContentsMargins(0, 0, 0, 0) self.setLayout(self.hlayout) self.minimum = datetime.date.min self.maximum = datetime.date.max self.setFocusProxy(self.line_edit) self.line_edit.editingFinished.connect( self.line_edit_finished ) self.line_edit.textEdited.connect(self.text_edited) special_date_menu.triggered.connect(self.set_special_date)
def home(self): btn = QtGui.QPushButton('Quit', self) # btn.clicked.connect(QtCore.QCoreApplication.instance().quit) btn.clicked.connect(self.close_application) btn.resize(btn.sizeHint()) btn.move(100, 100) extractAction = QtGui.QAction(QtGui.QIcon('ruby3.png'), 'Flee the scene', self) extractAction.triggered.connect(self.close_application) self.toolBar = self.addToolBar('Extraction') self.toolBar.addAction(extractAction) fontChoice = QtGui.QAction('Font', self) fontChoice.triggered.connect(self.font_choice) # self.toolBar = self.addToolBar('Font') self.toolBar.addAction(fontChoice) color = QtGui.QColor(0, 0, 0) fontColor = QtGui.QAction('Font bg color', self) fontColor.triggered.connect(self.color_picker) self.toolBar.addAction(fontColor) checkBox = QtGui.QCheckBox('Enlarge Window', self) checkBox.move(300, 25) # checkBox.toggle() checkBox.stateChanged.connect(self.enlarge_window) self.progress = QtGui.QProgressBar(self) self.progress.setGeometry(200, 80, 250, 20) self.btn = QtGui.QPushButton('Download', self) self.btn.move(200, 120) self.btn.clicked.connect(self.download) charles = self.style().objectName() print self.style().objectName() self.styleChoice = QtGui.QLabel(charles, self) comboBox = QtGui.QComboBox(self) comboBox.addItem('motif') comboBox.addItem('Windows') comboBox.addItem('css') comboBox.addItem('Plastique') comboBox.addItem('Cleanlooks') comboBox.addItem('Windowsvista') comboBox.move(50, 250) self.styleChoice.move(50, 150) comboBox.activated[str].connect(self.style_choice) cal = QtGui.QCalendarWidget(self) cal.move(500, 200) cal.resize(200, 200) self.show()
def initDownloaderParams(self): layoutDownloadParams = QtGui.QVBoxLayout(self) layoutAddNewSymbol = QtGui.QHBoxLayout(self) labelNewToDownload = QtGui.QLabel(self.tr('New symbol to download:')) self.editSymbolToAdd = QtGui.QLineEdit() addNewSymbol = QtGui.QPushButton(self.tr('Add')) layoutAddNewSymbol.addWidget(labelNewToDownload) layoutAddNewSymbol.addWidget(self.editSymbolToAdd) layoutAddNewSymbol.addWidget(addNewSymbol) self.connect(addNewSymbol,QtCore.SIGNAL("clicked()"),self.slotAddNewSymbol) layoutParameters = QtGui.QGridLayout(self) lablePeriod = QtGui.QLabel(self.tr("Period:")) periodComboBox=QtGui.QComboBox() self.periodComboBox = periodComboBox periodComboBox.insertItem(0,self.tr("D")) periodComboBox.insertItem(1,self.tr("min")) lableTimeStart = QtGui.QLabel(self.tr("Time start:")) timeStart = QtGui.QCalendarWidget() timeStart=QtGui.QDateTimeEdit() self.timeStartTimeEdit = timeStart timeStart.setDateTime(QtCore.QDateTime.fromString('2010-01-01 02:00:00','yyyy-MM-dd hh:mm:ss')) timeStart.setDisplayFormat("yyyy-MM-dd hh:mm:ss") timeStart.setCalendarPopup(True) lableTimeEnd = QtGui.QLabel(self.tr("Time end")) timeEnd=QtGui.QDateTimeEdit() self.timeEndTimeEdit = timeEnd timeEnd.setDateTime(QtCore.QDateTime.currentDateTime()) timeEnd.setDisplayFormat("yyyy-MM-dd hh:mm:ss") timeEnd.setCalendarPopup(True) layoutParameters.addWidget(lablePeriod,1,0) layoutParameters.addWidget(periodComboBox,1,1) layoutParameters.addWidget(lableTimeStart,2,0) layoutParameters.addWidget(timeStart,2,1) layoutParameters.addWidget(lableTimeEnd,3,0) layoutParameters.addWidget(timeEnd,3,1) DownloadOneButton=QtGui.QPushButton(self.tr("DownloadSelected")) DownloadAllButton=QtGui.QPushButton(self.tr("DownloadAll")) self.connect(DownloadOneButton,QtCore.SIGNAL("clicked()"),self.slotDownloadSelected) self.connect(DownloadAllButton,QtCore.SIGNAL("clicked()"),self.slotDownloadAll) layoutDownloadParams.addLayout(layoutParameters) layoutDownloadParams.addLayout(layoutAddNewSymbol) layoutDownloadParams.addWidget(DownloadOneButton) layoutDownloadParams.addWidget(DownloadAllButton) return layoutDownloadParams
def home(self): btn = QtGui.QPushButton("Quit", self) btn.resize(btn.minimumSizeHint()) btn.move(self.height() / 2 - btn.height() / 2, self.width() / 2 - btn.width() / 2) btn.clicked.connect(self.close_application) extractAction = QtGui.QAction(QtGui.QIcon('iconn.png'), 'Flee the Scene', self) extractAction.triggered.connect(self.close_application) checkBox = QtGui.QCheckBox('Enlarge Window', self) checkBox.move(200, 200) checkBox.stateChanged.connect(self.enlarge_window) checkBox.toggle() self.progress = QtGui.QProgressBar(self) self.progress.setGeometry(200, 80, 250, 20) self.btn = QtGui.QPushButton("Download", self) self.btn.move(200, 120) self.btn.clicked.connect(self.download) print(self.style().objectName()) self.styleChoice = QtGui.QLabel("Linux", self) comboBox = QtGui.QComboBox(self) comboBox.addItem("motif") comboBox.addItem("cde") comboBox.addItem('Plastique') comboBox.addItem('Cleanlooks') comboBox.move(50, 250) self.styleChoice.move(50, 150) comboBox.activated[str].connect(self.style_choice) self.toolbar = self.addToolBar("Extraction") self.toolbar.addAction(extractAction) fontChoice = QtGui.QAction('Font', self) fontChoice.triggered.connect(self.font_choice) self.toolbar = self.addToolBar('Font Choice') self.toolbar.addAction(fontChoice) color = QtGui.QColor(0, 0, 0) fontColor = QtGui.QAction('Font bg Color', self) fontColor.triggered.connect(self.color_picker) self.toolbar.addAction(fontColor) cal = QtGui.QCalendarWidget(self) cal.move(500, 200) cal.resize(200, 200) self.show()