예제 #1
0
 def __init__(self):
     super().__init__()
     self.started = False
     self.current_user = User()
     self.current_user.get_user_data()
     self.ui = Ui_ImportDateDialog()
     self.ui.setupUi(self)
     self.ui.date_start.setDate(QDate.currentDate())
     self.ui.date_end.setDate(QDate.currentDate().addDays(1))
     self.setModal(True)
     self.threadpool = QThreadPool()
     self.setup_signals()
예제 #2
0
    def set_calendar(self):
        """Setup Calendar widget"""
        calendar = self._window.calendar
        calendar.setGridVisible(True)
        calendar.setMinimumDate(QDate(1900, 1, 1))
        calendar.setMaximumDate(QDate.currentDate())
        calendar.setFirstDayOfWeek(Qt.Thursday)
        weekend_format = QTextCharFormat()
        weekend_format.setForeground(QBrush(Qt.green, Qt.SolidPattern))
        calendar.setWeekdayTextFormat(Qt.Saturday, weekend_format)
        calendar.setWeekdayTextFormat(Qt.Sunday, weekend_format)
        weekend_format.setForeground(QBrush(QColor('#8800BB'),
                                            Qt.SolidPattern))
        calendar.setDateTextFormat(QDate.currentDate(), weekend_format)

        calendar.clicked.connect(self._window.date_edit.setDate)
예제 #3
0
 def exportDipsToURL(self,
                     dipoles,
                     directoryURL,
                     fileName,
                     addDateToExport=True):
     dateStr = ("-" + QDate.currentDate().toString(Qt.ISODate)
                ) if addDateToExport else ""
     filename = QUrl(directoryURL).toLocalFile() + (
         QDir.separator() + fileName + dateStr + ".csv").replace(" ", "_")
     file = QSaveFile(filename)
     file.open(QIODevice.WriteOnly)
     file.write(
         QByteArray(
             bytearray("x,y,z,phi (°),theta (°),moment (mu_B)\n", 'utf-8')))
     for dip in dipoles:
         angles = anglesQuaternionToSph(dip.quaternion)
         line = str(dip.position.x()) + "," + str(
             dip.position.y()) + "," + str(dip.position.z()) + "," + str(
                 degrees(angles[0])) + "," + str(degrees(
                     angles[1])) + "," + str(dip.moment) + "\n"
         line = QByteArray(bytearray(line, 'utf-8'))
         file.write(line)
     file.commit()
     if (file.errorString() == "Unknown error"):
         return True
     else:
         return False
예제 #4
0
 def __init__(self):
     super().__init__()
     self.ui = Ui_ImportDateDialog()
     self.ui.setupUi(self)
     self.ui.dateinput_button.setDate(QDate.currentDate())
     self.setModal(True)
     self.setup_signals()
예제 #5
0
 def verify_inputs(self):
     if (self.view.date_of_entry.date().toJulianDay() >
             QDate.currentDate().toJulianDay()):
         View.show_message("Selected date should not exceed today date",
                           "error")
         return False
     if self.view.trans_type.currentIndex() <= 1:
         if self.view.money.text() != "":
             if self.source_table == "CASH":
                 return True
             elif self.view.source_btn_group.checkedId() > 1:
                 if self.view.cheque_number.text() != "":
                     return True
                 View.show_message("Enter Cheque Number", "error")
             else:
                 View.show_message("Select money Source", "error")
         else:
             View.show_message("Please Enter money", "error")
     else:
         if self.source_table is not None:
             if self.view.money.text() != "":
                 return True
             else:
                 View.show_message("Please Enter money", "error")
         else:
             View.show_message("Select money Source", "error")
     return False
예제 #6
0
 def setDateRange(self, start, end=0):
     self._begin = start
     if end:
         self._end = end
     else:
         self._end = QDate.currentDate().endOfDay(Qt.UTC).toSecsSinceEpoch()
     self.prepareData()
예제 #7
0
def test_wizard(mocker, qtbot, os, bits, wizard_class, pages):
    mozinfo = mocker.patch('mozregui.wizard.mozinfo')
    mozinfo.os = os
    mozinfo.bits = bits

    wizard = wizard_class()
    qtbot.addWidget(wizard)
    wizard.show()
    qtbot.waitForWindowShown(wizard)

    for page_class in pages:
        assert isinstance(wizard.currentPage(), page_class)
        wizard.next()

    # everything has been visited
    assert wizard.visitedPages() == wizard.pageIds()

    fetch_config, options = wizard.options()

    now = QDate.currentDate()

    assert isinstance(fetch_config, CommonConfig)
    assert fetch_config.app_name == 'firefox'  # this is the default
    assert fetch_config.os == os
    assert fetch_config.bits == bits
    assert fetch_config.build_type == 'shippable'
    assert not fetch_config.repo

    assert options['profile'] == ''
    if isinstance(wizard, SingleRunWizard):
        assert options['launch'] == now.addDays(-3).toPython()
    else:
        assert options['good'] == now.addYears(-1).toPython()
        assert options['bad'] == now.toPython()
예제 #8
0
    def __init__(self, parent=None):                                        # + parent=None
        super().__init__(parent)                                            # + parent
        self.setLayout(QFormLayout())
        self.inputs = dict()
        self.inputs['Customer Name'] = QLineEdit()
        self.inputs['Customer Address'] = QPlainTextEdit()
        self.inputs['Invoice Date'] = QDateEdit(date=QDate.currentDate(), calendarPopup=True)
        self.inputs['Days until Due'] = QSpinBox()
        for label, widget in self.inputs.items():
            self.layout().addRow(label, widget)

        self.line_items = QTableWidget(rowCount=10, columnCount=3)
        self.line_items.setHorizontalHeaderLabels(['Job', 'Rate', 'Hours'])
        self.line_items.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
        self.layout().addRow(self.line_items)
        for row in range(self.line_items.rowCount()):
            for col in range(self.line_items.columnCount()):
                if col > 0:
                    w = QSpinBox()
                    self.line_items.setCellWidget(row, col, w)

        submit = QPushButton('Create Invoice', clicked=self.on_submit)
        
# +     vvvvvv                                        vvvvvvvvvvvvv 
        _print = QPushButton('Print Invoice', clicked=self.window().printpreviewDialog)  # + _print, + self.window()
        self.layout().addRow(submit, _print)                                             # + _print
예제 #9
0
    def __init__(self, action, parent=None):
        super(EditIncomingActs, self).__init__(parent)
        self.path = os.path.join('faces', 'edit_invoicing.ui')
        self.ui_file = QFile(self.path)
        self.ui_file.open(QFile.ReadOnly)
        self.loader = QUiLoader()
        self.dialog = self.loader.load(self.ui_file, self)
        self.ui_file.close()

        self.action = action

        # определим элементы управления
        self.date_edit = self.dialog.findChild(QDateEdit, 'date_edit')
        self.table_service = self.dialog.findChild(QTableWidget,
                                                   'table_service')
        self.comment_edit = self.dialog.findChild(QLineEdit, 'comment_edit')
        self.table_total = self.dialog.findChild(QTableWidget, 'table_total')
        self.cmbox_company = self.dialog.findChild(QComboBox, 'cmbox_company')
        self.btn_save = self.dialog.findChild(QPushButton, 'btn_save')
        self.btn_add = self.dialog.findChild(QPushButton, 'btn_add')
        self.btn_changed = self.dialog.findChild(QPushButton, 'btn_changed')
        self.btn_delete = self.dialog.findChild(QPushButton, 'btn_delete')

        # назначим подсказки для элементов
        self.btn_save.setToolTip('Сохранить акт')
        self.btn_add.setToolTip('Добавить услугу, товар')
        self.btn_changed.setToolTip('Изменить услугу, товар')
        self.btn_delete.setToolTip('Удалить услугу, товар')

        # задаём специальные размеров колонок основной таблицы
        self.table_service.setColumnWidth(0, 329)  # наименование услуг
        self.table_service.setColumnWidth(1, 100)  # количество
        self.table_service.setColumnWidth(2, 100)  # цена
        self.table_service.setColumnWidth(3, 100)  # сумма

        # задаём специальные размеров колонок итоговой таблицы
        self.table_total.setColumnWidth(0, 549)  # наименование услуг
        self.table_total.setColumnWidth(1, 80)  # количество

        # замена имени колонки в форме
        self.table_total.horizontalHeaderItem(0).setText('Итого по актам')

        # добавляем значения по умолчанию: текущую дату
        self.date_edit.setDate(QDate.currentDate())
        # список контроагентов
        result = conn.query(Counterparties).all()
        if result:
            for elem in result:
                self.cmbox_company.addItem(str(elem.name_c))

        # назначим подсказки для элементов
        self.btn_add.setToolTip('Добавить')
        self.btn_delete.setToolTip('Удалить')

        # назначим действия для объектов
        self.btn_save.clicked.connect(self.save_service)
        self.btn_add.clicked.connect(self.insert_service)
        self.btn_changed.clicked.connect(self.edit_service)
        self.btn_delete.clicked.connect(self.dell_service)
 def printReceipt(self):
     self.playSound('audio4')
     # printer = Usb(idVendor=0x0416, idProduct=0x5011, timeout=0, in_ep=0x81, out_ep=0x03)
     os.system('sudo -S python3 printer.py ' + str(self.total_price) +
               ' --datetime "' +
               QDate.currentDate().toString(Qt.DefaultLocaleShortDate) +
               '-' +
               QTime.currentTime().toString(Qt.DefaultLocaleShortDate) +
               '"')
     self.stackStart()
예제 #11
0
파일: zhujiemian.py 프로젝트: 405218718/QMS
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.setCalendarPopup(True)
     self.clear()  # 设置初始文本为空串
     self.setDate(QDate.currentDate())
     self.calendarWidget().clicked.connect(
         lambda: {
             # 选择日期后,Edit 根据内容会自动调用 textFromDateTime 设置最终的显示文本。
             self.lineEdit().setText(self.text() or " ")
         })
예제 #12
0
    def visualize_bone_age_data(
            self, data: Data,
            data_viewer_sub_windows: List[DataViewerSubWindow]):
        print('visualize_bone_age_data', type(data))

        if isinstance(data, LayeredImage):
            first_layer = data.layers[0]

            default_gender_is_male = True
            image = first_layer.image
            predicted_bone_age, activation_map = self.predictor.predict(
                image, default_gender_is_male)
            record = PatientBoneAgeRecord(
                image, default_gender_is_male, QDate(2010, 1, 1),
                QDate.currentDate(), date.months_to_days(predicted_bone_age))
            record.male_changed.connect(
                partial(self._on_record_male_changed, record))
            self.journal.add_record(record)

            self.records_image_sub_windows[record] = data_viewer_sub_windows

            for sub_window in data_viewer_sub_windows:
                sub_window.layout_anchors = np.array([[0.6, 0], [1, 1]])
                sub_window.lay_out_to_anchors()

            # Add a layer with the activation map
            activation_map = skimage.transform.resize(activation_map,
                                                      image.array.shape[:2],
                                                      order=3)
            activation_map = image_converter.normalized_uint8(activation_map)

            activation_map_color_transfer_function = ColorTransferFunction.default_jet(
            )
            activation_map_color_transfer_function.points[
                0].color_array = np.array([0, 0, 255, 0])
            activation_map_palette = color_converter.color_transfer_function_to_palette(
                activation_map_color_transfer_function)

            activation_map_layer = data.add_layer_from_image(
                FlatImage(array=activation_map,
                          palette=activation_map_palette),
                name=self.ACTIVATION_MAP_LAYER_NAME)

            activation_map_layer_views = []
            for sub_window in data_viewer_sub_windows:
                activation_map_layer_view = sub_window.viewer.layer_view_by_model(
                    activation_map_layer)
                activation_map_layer_view.opacity = 0.5
                activation_map_layer_views.append(activation_map_layer_view)
            activation_map_visibility_widget = LayerVisibilityWidget(
                activation_map_layer_views, embedded=True)
            # activation_map_visibility_widget.slider_bar_color = QColor(240, 206, 164)
            # activation_map_visibility_widget.toggle_button_checked_color = QColor(240, 206, 164)
            self.journal_viewer.add_record_activation_map_visibility_widget(
                record, activation_map_visibility_widget)
예제 #13
0
 def nextImageFileName(self):
     picturesLocation = QStandardPaths.writableLocation(QStandardPaths.PicturesLocation)
     dateString = QDate.currentDate().toString("yyyyMMdd")
     pattern = picturesLocation + "/pyside2_camera_" + dateString + "_{:03d}.jpg"
     n = 1
     while True:
         result = pattern.format(n)
         if not os.path.exists(result):
             return result
         n = n + 1
     return None
예제 #14
0
 def __init__(self):
     self.view = View()
     self.model = Model()
     self.only_double = QDoubleValidator()
     self.today = QDate.currentDate()
     self.source_table = None
     self.last_reverse_entry_btn = None  # for uncheck reversed entry button group
     self.settings = QWebEngineSettings.globalSettings()
     Thread(target=self.fil_upto_today, daemon=True).start()
     self.set_events()
     self.set_method_of_trans()
예제 #15
0
 def nextImageFileName(self):
     picturesLocation = QStandardPaths.writableLocation(QStandardPaths.PicturesLocation)
     dateString = QDate.currentDate().toString("yyyyMMdd")
     pattern = picturesLocation + "/pyside2_camera_" + dateString + "_{:03d}.jpg"
     n = 1
     while True:
         result = pattern.format(n)
         if not os.path.exists(result):
             return result
         n = n + 1
     return None
 def _show_calendar(self):
     start = self._model.value.start
     if start.year >= 100:
         self._calendar.setSelectedDate(QDate(start.year, start.month, start.day))
     else:
         self._calendar.setSelectedDate(QDate.currentDate())
     button_position = self._ui.calendar_button.mapToGlobal(QPoint(0, 0))
     calendar_x = button_position.x()
     calendar_y = button_position.y() + self._ui.calendar_button.height()
     self._calendar.move(calendar_x, calendar_y)
     self._calendar.show()
예제 #17
0
 def __init__(self, parent_view):
     super().__init__(parent_view)
     self._view = parent_view
     self._data = []
     self._currency = 0
     self._currency_name = ''
     self._active_only = True
     self._date = QDate.currentDate().endOfDay(Qt.UTC).toSecsSinceEpoch()
     self._columns = [
         g_tr('BalancesModel', "Account"),
         g_tr('BalancesModel', "Balance"), " ",
         g_tr('BalancesModel', "Balance, ")
     ]
        def initForm(self):
            date: QDate = QDate.currentDate()
            time: QTime = QTime.currentTime()

            self.tumblerDateTime1.year = date.year()
            self.tumblerDateTime1.month = date.month()
            self.tumblerDateTime1.day = date.day()
            self.tumblerDateTime1.hour = time.hour()
            self.tumblerDateTime1.min = time.minute()
            self.tumblerDateTime1.sec = time.second()

            self.tumblerDateTime2.setDateTime(date.year(), date.month(), date.day(),
                                              time.hour(), time.minute(), time.second())
예제 #19
0
파일: ledger.py 프로젝트: uMag/ledger
    def __init__(self, parent, frontier):
        QDialog.__init__(self)
        self.setupUi(self)

        self.LastRadioButton.toggle()
        self.frontier = frontier
        frontier_text = datetime.fromtimestamp(frontier).strftime('%d/%m/%Y')
        self.FrontierDateLabel.setText(frontier_text)
        self.CustomDateEdit.setDate(QDate.currentDate())

        # center dialog with respect to parent window
        x = parent.x() + parent.width() / 2 - self.width() / 2
        y = parent.y() + parent.height() / 2 - self.height() / 2
        self.setGeometry(x, y, self.width(), self.height())
예제 #20
0
    def __init__(self, parent=None):
        super(ShowBankDocs, self).__init__(parent)
        self.path = os.path.join('faces', 'show_bank_docs.ui')

        self.ui_file = QFile(self.path)
        self.ui_file.open(QFile.ReadOnly)
        self.loader = QUiLoader()
        self.dialog = self.loader.load(self.ui_file, self)
        self.ui_file.close()



        # определим элементы управления
        self.label = self.dialog.findChild(QLabel, 'label')
        self.date_start = self.dialog.findChild(QDateEdit, 'date_start')
        self.date_end = self.dialog.findChild(QDateEdit, 'date_end')
        self.cmbox_company = self.dialog.findChild(QComboBox, 'cmbox_company')
        self.cmbox_action = self.dialog.findChild(QComboBox, 'cmbox_action')
        self.btn_create = self.dialog.findChild(QPushButton, 'btn_create')

        # назначим подсказки для элементов
        self.btn_create.setToolTip('Сформировать отчёт')

        # добавляем значения по умолчанию: текущую дату
        self.date_start.setDate(QDate.currentDate())
        self.date_end.setDate(QDate.currentDate())
        # список контроагентов
        result = conn.query(Counterparties).all()
        if result:
            for elem in result:
                self.cmbox_company.addItem(str(elem.name_c))

        # назначим действия для объектов
        self.btn_create.clicked.connect(self.create_report)

        self.setMaximumHeight(225)
        self.setMaximumWidth(473)
 def __init__(self, parent=None):
     super().__init__(parent)
     self.setWindowTitle("Export Timesheet")
     self.setFixedSize(220, 95)
     grid_layout = QGridLayout(self)
     self.start_date_picker = DatePicker()
     self.start_date_picker.dateChanged.connect(self.start_date_chosen)
     self.end_date_picker = DatePicker()
     self.end_date_picker.setDate(QDate.currentDate().addDays(6))
     self.end_date_picker.setMinimumDate(QDate.currentDate())
     self.start_date_label = QLabel()
     self.start_date_label.setText("Start Date")
     self.end_date_label = QLabel()
     self.end_date_label.setText("End Date")
     self.export_button_box = QDialogButtonBox(QDialogButtonBox.Ok
                                               | QDialogButtonBox.Cancel)
     self.export_button_box.accepted.connect(self.button_clicked)
     self.export_button_box.rejected.connect(self.close)
     # TODO Add a cancel button
     grid_layout.addWidget(self.start_date_label, 0, 0)
     grid_layout.addWidget(self.end_date_label, 0, 1)
     grid_layout.addWidget(self.start_date_picker, 1, 0)
     grid_layout.addWidget(self.end_date_picker, 1, 1)
     grid_layout.addWidget(self.export_button_box, 2, 0, 2, 0)
    def __init__(self, parent: QWidget = None):
        super(ShadowCalendar, self).__init__(parent)
        self.__bgColor: QColor = QColor("#212425")  # 背景颜色
        self.__textColor: QColor = QColor("#FFFFFF")  # 文字颜色
        self.__shadowColor: QColor = QColor("#FFFFFF")  # 光晕颜色
        self.__selectColor: QColor = QColor("#0078D7")  # 选中颜色

        self.__selectDate: QDate = QDate()  # 今天日期
        self.__dateItem: List[List[ShadowCalendar.DateItem], ]
        self.__dateItem = [[ShadowCalendar.DateItem() for column in range(7)]
                           for row in range(6)]  # 日期数组 [6][7]

        # 首次主动设置日期
        self.updateCalendar(QDate.currentDate())

        # 开启鼠标追踪
        self.setMouseTracking(True)
예제 #23
0
파일: panel2.py 프로젝트: Zamtos/Panel2
    def newLetter(self):
        self.textEdit.clear()

        cursor = self.textEdit.textCursor()
        cursor.movePosition(QTextCursor.Start)
        topFrame = cursor.currentFrame()
        topFrameFormat = topFrame.frameFormat()
        topFrameFormat.setPadding(16)
        topFrame.setFrameFormat(topFrameFormat)
        #        timer = QTimer(self)
        #        timer.timeout.connect(self.showTime)
        #        timer.start(1000)
        textFormat = QTextCharFormat()
        boldFormat = QTextCharFormat()
        boldFormat.setFontWeight(QFont.Bold)
        italicFormat = QTextCharFormat()
        italicFormat.setFontItalic(True)

        tableFormat = QTextTableFormat()
        tableFormat.setBorder(1)
        tableFormat.setCellPadding(16)
        tableFormat.setAlignment(Qt.AlignRight)
        cursor.insertTable(1, 1, tableFormat)
        cursor.insertText("Tomasz Dróżdż", boldFormat)
        cursor.insertBlock()
        cursor.insertText("Politechnika Wrocławska", textFormat)
        cursor.insertBlock()
        cursor.insertText("Automatyka i Robotyka")
        cursor.insertBlock()
        cursor.insertText("SOLAR PANEL Program")
        cursor.setPosition(topFrame.lastPosition())
        cursor.insertText(
            QDate.currentDate().toString("Dziś jest: d MMMM yyyy:"),
            textFormat)
        cursor.insertText(QTime.currentTime().toString("  hh:mm:ss"),
                          textFormat)
        #        cursor.insertText(QTimer.timer("  hh:mm:ss", 1000), textFormat)
        cursor.insertBlock()
        cursor.insertBlock()
        cursor.insertText("Wrocław: ", textFormat)
        cursor.insertText("17.03 deg; 51.10 deg", textFormat)
        cursor.insertText(",", textFormat)
        for i in range(3):
            cursor.insertBlock()
        cursor.insertText("Text", textFormat)
예제 #24
0
    def __init__(self, conn):
        '''
        Parameters:
            conn : connection
                Connection to the database.
        '''
        super().__init__()
        self.setWindowTitle('Aggiungi Cliente')
        self.setWindowFlag(QtCore.Qt.WindowContextHelpButtonHint, False)

        self.conn = conn
        self.cursor = conn.cursor()

        self.gen_layout = QVBoxLayout()

        self.form_layout = QFormLayout()
        self.form_layout.setRowWrapPolicy(QFormLayout.WrapLongRows)

        # Widgets

        self.nome_field = QLineEdit()
        self.form_layout.addRow('Nome: ', self.nome_field)

        self.cognome_field = QLineEdit()
        self.form_layout.addRow('Cognome: ', self.cognome_field)

        self.date_field = QDateEdit(QDate.currentDate())
        self.date_field.setDisplayFormat("MM/dd/yyyy")
        self.date_field.setCalendarPopup(True)
        self.form_layout.addRow('Data di nascita (mm/gg/aaaa): ',
                                self.date_field)

        self.phone_field = QLineEdit()
        self.form_layout.addRow('Telefono (solo cifre): ', self.phone_field)

        self.email_field = QLineEdit()
        self.form_layout.addRow('E-Mail: ', self.email_field)

        self.confirm_button = QPushButton('Conferma')
        self.confirm_button.clicked.connect(self.post_cliente)

        self.gen_layout.addLayout(self.form_layout)
        self.gen_layout.addWidget(self.confirm_button)
        self.setLayout(self.gen_layout)
예제 #25
0
    def newLetter(self):
        self.textEdit.clear()

        cursor = self.textEdit.textCursor()
        cursor.movePosition(QTextCursor.Start)
        topFrame = cursor.currentFrame()
        topFrameFormat = topFrame.frameFormat()
        topFrameFormat.setPadding(16)
        topFrame.setFrameFormat(topFrameFormat)

        textFormat = QTextCharFormat()
        boldFormat = QTextCharFormat()
        boldFormat.setFontWeight(QFont.Bold)
        italicFormat = QTextCharFormat()
        italicFormat.setFontItalic(True)

        tableFormat = QTextTableFormat()
        tableFormat.setBorder(1)
        tableFormat.setCellPadding(16)
        tableFormat.setAlignment(Qt.AlignRight)
        cursor.insertTable(1, 1, tableFormat)
        cursor.insertText("The Firm", boldFormat)
        cursor.insertBlock()
        cursor.insertText("321 City Street", textFormat)
        cursor.insertBlock()
        cursor.insertText("Industry Park")
        cursor.insertBlock()
        cursor.insertText("Some Country")
        cursor.setPosition(topFrame.lastPosition())
        cursor.insertText(QDate.currentDate().toString("d MMMM yyyy"),
                          textFormat)
        cursor.insertBlock()
        cursor.insertBlock()
        cursor.insertText("Dear ", textFormat)
        cursor.insertText("NAME", italicFormat)
        cursor.insertText(",", textFormat)
        for i in range(3):
            cursor.insertBlock()
        cursor.insertText("Yours sincerely,", textFormat)
        for i in range(3):
            cursor.insertBlock()
        cursor.insertText("The Boss", textFormat)
        cursor.insertBlock()
        cursor.insertText("ADDRESS", italicFormat)
예제 #26
0
    def testInsert(self):
        myHash = {}
        qdate = QDate.currentDate()
        qdatetime = QDateTime.currentDateTime()
        qtime = QTime.currentTime()
        qurl = QUrl("http://www.pyside.org")
        qpoint = QPoint(12, 42)

        myHash[qdate] = "QDate"
        myHash[qdatetime] = "QDateTime"
        myHash[qtime] = "QTime"
        myHash[qurl] = "QUrl"
        myHash[qpoint] = "QPoint"

        self.assertEqual(myHash[qdate], "QDate")
        self.assertEqual(myHash[qdatetime], "QDateTime")
        self.assertEqual(myHash[qtime], "QTime")
        self.assertEqual(myHash[qurl], "QUrl")
        self.assertEqual(myHash[qpoint], "QPoint")
예제 #27
0
    def testInsert(self):
        myHash = {}
        qdate = QDate.currentDate()
        qdatetime = QDateTime.currentDateTime()
        qtime = QTime.currentTime()
        qurl = QUrl("http://www.pyside.org")
        qpoint = QPoint(12, 42)

        myHash[qdate] = "QDate"
        myHash[qdatetime] = "QDateTime"
        myHash[qtime] = "QTime"
        myHash[qurl] = "QUrl"
        myHash[qpoint] = "QPoint"

        self.assertEqual(myHash[qdate], "QDate")
        self.assertEqual(myHash[qdatetime], "QDateTime")
        self.assertEqual(myHash[qtime], "QTime")
        self.assertEqual(myHash[qurl], "QUrl")
        self.assertEqual(myHash[qpoint], "QPoint")
예제 #28
0
    def __init__(self):
        super().__init__()

        self.file_loaded = SmartBool(False)

        # load the ui file
        self.ui = QUiLoader().load('bhtd_shell2.ui')

        # add the log viewer
        self.log_display = QTextEditLogger(self)
        self.log_display.setFormatter(
            logging.Formatter('%(levelname)s:  %(message)s'))
        log.addHandler(self.log_display)
        bh.log.addHandler(
            self.log_display)  # pipe the log from the BHTD module to display
        self.ui.horizontalLayout.addWidget(self.log_display.widget)

        # set the default report date to four months before current date
        now = QDate.currentDate()
        default_report_date = now.addMonths(-8)  # should be 4
        self.ui.dateEdit.setDate(default_report_date)

        # add the range display label
        self.range_label = QLabel()
        self.ui.verticalLayout_2.addWidget(self.range_label)

        # set the save_report_btn's initial state to disabled
        self.ui.save_report_btn.setEnabled(False)

        # connect signals/slots
        self.ui.load_file_btn.clicked.connect(self.on_load_file_btn_click)
        self.ui.save_report_btn.clicked.connect(self.on_save_report_btn_click)
        self.file_loaded.valueChanged.connect(self.on_file_loaded_changed)

        # welcome message
        self.log_display.widget.appendPlainText(
            'Welcome to the Behavioral Health Therapy Dosage Reporting Tool!')
        self.log_display.widget.appendPlainText(
            'Please load the therapy dosage report from PI-EDW.')
        self.log_display.widget.appendPlainText(
            'Note: This program will permit generating reports with incomplete follow-up data.\n'
        )
예제 #29
0
 def __init__(self, parent_view):
     super().__init__(parent_view)
     self._view = parent_view
     self._grid_delegate = None
     self._root = None
     self._currency = 0
     self._currency_name = ''
     self._date = QDate.currentDate().endOfDay(Qt.UTC).toSecsSinceEpoch()
     self._columns = [
         g_tr('HoldingsModel', "Currency/Account/Asset"),
         g_tr('HoldingsModel', "Asset Name"),
         g_tr('HoldingsModel', "Qty"),
         g_tr('HoldingsModel', "Open"),
         g_tr('HoldingsModel', "Last"),
         g_tr('HoldingsModel', "Share, %"),
         g_tr('HoldingsModel', "P/L, %"),
         g_tr('HoldingsModel', "P/L"),
         g_tr('HoldingsModel', "Value"),
         g_tr('HoldingsModel', "Value, ")
     ]
예제 #30
0
    def __init__(self, parent, mirror_task):
        super(DlgScedule, self).__init__(parent)
        # setup UI
        self.ui = Ui_DlgSchedule()
        self.ui.setupUi(self)
        # selected task
        self._mirrorTask = mirror_task
        # schedule manager
        self._manager = ScheduledTasksManager()

        # connect slots
        self.ui.btnOK.clicked.connect(lambda: self.Btn_Clicked(self.ui.btnOK))
        self.ui.btnCancel.clicked.connect(
            lambda: self.Btn_Clicked(self.ui.btnCancel))
        self.ui.checkBox.clicked.connect(
            lambda: self.Btn_Clicked(self.ui.checkBox))
        # set checkbox
        self.ui.checkBox.setChecked(False)
        # make schedule types
        self.ui.comboBox.addItems(Settings.SCHEDULE_TYPES)
        # get task schedule task
        task = self._manager.Get(self._mirrorTask)
        try:
            if task is not None:
                # get next triger time
                time = task.LastRunTime
                # get time stamp
                dt = datetime.datetime.fromtimestamp(
                    timestamp=time.timestamp(), tz=time.tzinfo)
                # set checkbox
                self.ui.checkBox.setChecked(task.Enabled)
                # set date & time
                self.ui.dateEdit.setDate(QDate(dt.year, dt.month, dt.day))
                self.ui.timeEdit.setTime(QTime(dt.hour, dt.minute, dt.day))
            else:
                self.ui.dateEdit.setDate(QDate.currentDate())
                self.ui.timeEdit.setTime(QTime.currentTime())
            # enable controls
            self.EnableControls()
        except Exception as e:
            print(f'Schedule Dlg Err:{e}')
예제 #31
0
 def starting_printing_process(self):
     if self.is_printing:
         self.print_text_signal.emit("Already printing!")
         return
     if self.__motor_controller.is_connected or DEBUG_MODE_ON:
         self.printing_date = QDate.currentDate().toString("yyyy.MM.dd")
         self.printing_time = QTime.currentTime().toString("hh.mm.ss")
         self.is_printing = True
         self.block_parameters_signal.emit()
         self.current_layer = 0
         self.current_burning_layer = 0
         self.number_of_layers = len(self.features_file_names) + len(
             self.support_file_names)
         self.print_text_signal.emit("Starting printing process ...")
         self.__print_support_parameters__()
         self.__print_features_parameters__()
         if DEBUG_MODE_ON:
             self.prepare_next_layer()
         else:
             self.__motor_controller.begin_printing_process()
     else:
         self.print_text_signal.emit("The printer is NOT connected!")
예제 #32
0
def new_date_input(parent, title_str, date=None):
    """
    creates input with title
    :param parent:
    :param title_str:
    :param hint_str:
    :param only_numbers:
    :return:
    """
    widget = QWidget(parent)
    widget.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Maximum)

    # layout
    layout = QVBoxLayout()
    layout.setMargin(0)
    layout.setSpacing(2)

    # label
    title = QLabel(widget)
    title.setText(title_str)
    title.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Maximum)

    # text edit
    widget.date_input = QDateEdit(widget)

    if date is None:
        widget.date_input.setDate(QDate.currentDate())
    else:
        widget.date_input.setDate(date)

    # add to layout
    layout.addWidget(title)
    layout.addWidget(widget.date_input)

    widget.setLayout(layout)

    return widget