Exemplo n.º 1
0
    def historyEntryAdded(self, entry):
        '''
        @param: entry HistoryEntry
        '''
        if not self._todayItem:
            self.beginInsertRows(QModelIndex(), 0, 0)

            self._todayItem = HistoryItem(None)
            self._todayItem.canFetchMore = True
            self._todayItem.setStartTimestamp(-1)
            self._todayItem.setEndTimestamp(
                QDateTime(QDate.currentDate()).toMSecsSinceEpoch())
            self._todayItem.title = _('Today')

            self._rootItem.prependChild(self._todayItem)

            self.endInsertRows()

        self.beginInsertRows(self.createIndex(0, 0, self._todayItem), 0, 0)

        item = HistoryItem()
        item.historyEntry = entry

        self._todayItem.prependChild(item)

        self.endInsertRows()
Exemplo n.º 2
0
    def _initUI(self):
        self._name = QLineEdit()
        self._name.setFixedHeight(30)
        self._name.setPlaceholderText("produto")

        self._stock = QSpinBox()
        self._stock.setMaximum(100000)
        self._stock.setFixedHeight(30)
        self._stock.setValue(10)

        self._price = QDoubleSpinBox()
        self._price.setDecimals(2)
        self._price.setMaximum(99999.99)
        self._price.setFixedHeight(30)
        self._price.setValue(10.0)

        self.inputCategory = QComboBox()
        self.inputCategory.setFixedHeight(30)

        self._date = QDateEdit()
        self._date.setDate(QDate.currentDate())

        self.addField("Nome do Produto", self._name)
        self.addField("Preço(R$)", self._price)
        self.addField("Estoque(Unidade)", self._stock)
        self.addField("Categoria", self.inputCategory)
        #self.addField("Validade", self._date)
        super(ProductWindow, self)._initUI()
Exemplo n.º 3
0
    def __init__(self, jsonFile=None, bucketName=None):

        super().__init__()
        self.setupUi(self)

        self.jsonFile = jsonFile
        self.bucketName = bucketName
        self.extra = Generic_extra()

        self.shelvePath = None
        self.lstImg = []
        self.lstPdf = []
        self.lstDocTypes = []
        self.lstPathFiles = []
        self.dictMetaData = {}
        self.clkFilePath = None

        #self.configCbModel()
        self.setLstDocType()
        self.setUpIcons()
        self.setLstPaths()
        self.setCombox()

        self.PBAdd.clicked.connect(self.addFilesToLst)  #working 100%
        self.PBRemove.clicked.connect(self.removeFileFromLst)  #working 100%
        self.LWPaths.clicked.connect(self.clickedItem)  #working 100%
        self.LWPaths.doubleClicked.connect(
            self.DoubleclickedItem)  #working 100%
        self.PBSave.clicked.connect(self.start_Save)
        self.PBClose.clicked.connect(self.ToClosed)  #working 100%
        self.DEData.setDate(QDate.currentDate())
        self.settingsButton.clicked.connect(self.onSettingsClicekd)
Exemplo n.º 4
0
 def clear(self):
     self._name.clear()
     self._price.setValue(1)
     self._stock.setValue(1)
     self.inputCategory.setCurrentIndex(0)
     self._date.setDate(QDate.currentDate())
     self._name.parent().setProperty("hint", False)
     self.inputCategory.parent().setProperty("hint", False)
     self.update()
Exemplo n.º 5
0
 def set_month_and_year(self):
     """
     Sets initial values for year and month boxes.
     """
     self.yearBox.addItems(YEARS)
     self.monthBox.addItems(MONTHS)
     current_date = QDate.currentDate()
     self.yearBox.setCurrentText(str(current_date.year()))
     self.monthBox.setCurrentText(MONTHS[current_date.month()])
Exemplo n.º 6
0
 def setEditorData(self, editor, index):
     val = index.data(Qt.EditRole)
     if check_key_modifier(Qt.ControlModifier):
         val = UNDEFINED_QDATETIME
     elif check_key_modifier(Qt.ShiftModifier + Qt.ControlModifier):
         val = now()
     elif is_date_undefined(val):
         val = QDate.currentDate()
     if isinstance(val, QDateTime):
         val = val.date()
     editor.setDate(val)
Exemplo n.º 7
0
 def setEditorData(self, editor, index):
     val = index.data(Qt.EditRole)
     if check_key_modifier(Qt.ControlModifier):
         val = UNDEFINED_QDATETIME
     elif check_key_modifier(Qt.ShiftModifier + Qt.ControlModifier):
         val = now()
     elif is_date_undefined(val):
         val = QDate.currentDate()
     if isinstance(val, QDateTime):
         val = val.date()
     editor.setDate(val)
Exemplo n.º 8
0
    def _init_date(self):
        # 日期设置
        current = QDate.currentDate()
        self.dateEdit.setDate(QDate(current.year(), current.month(), 1))
        self.dateEdit.setDisplayFormat("yyyy-MM-dd")

        self.dateEdit_2.setDate(current)
        self.dateEdit_2.setDisplayFormat("yyyy-MM-dd")

        settings.setValue(Configs.start_time, self.dateEdit.text())
        settings.setValue(Configs.end_time, self.dateEdit_2.text())
Exemplo n.º 9
0
    def _init(self):
        from .History import History
        minTs = HistoryDbModel.select(peewee.fn.Min(
            HistoryDbModel.date)).scalar()
        if minTs <= 0:
            return

        today = QDate.currentDate()
        week = today.addDays(1 - today.dayOfWeek())
        month = QDate(today.year(), today.month(), 1)
        currentTs = QDateTime.currentMSecsSinceEpoch()

        ts = currentTs
        while ts > minTs:
            tsDate = QDateTime.fromMSecsSinceEpoch(ts).date()
            endTs = 0
            itemName = ''

            if tsDate == today:
                endTs = QDateTime(today).toMSecsSinceEpoch()
                itemName = _('Today')
            elif tsDate >= week:
                endTs = QDateTime(week).toMSecsSinceEpoch()
                itemName = _('This Week')
            elif tsDate.month() == month.month() and tsDate.year(
            ) == month.year():
                endTs = QDateTime(month).toMSecsSinceEpoch()
                itemName = _('This Month')
            else:
                startDate = QDate(tsDate.year(), tsDate.month(),
                                  tsDate.daysInMonth())
                endDate = QDate(startDate.year(), startDate.month(), 1)

                ts = QDateTime(startDate, QTime(23, 59,
                                                59)).toMSecsSinceEpoch()
                endTs = QDateTime(endDate).toMSecsSinceEpoch()
                itemName = '%s %s' % (tsDate.year(),
                                      History.titleCaseLocalizedMonth(
                                          tsDate.month()))
            dbobj = HistoryDbModel.select().where(
                HistoryDbModel.date.between(endTs, ts)).first()
            if dbobj:
                item = HistoryItem(self._rootItem)
                item.setStartTimestamp(ts == currentTs and -1 or ts)
                item.setEndTimestamp(endTs)
                item.title = itemName
                item.canFetchMore = True

                if ts == currentTs:
                    self._todayItem = item

            ts = endTs - 1
Exemplo n.º 10
0
    def __init__(self):
        QWidget.__init__(self)
        self.ui = Ui_DateTimeWidget()
        self.ui.setupUi(self)
        self.timer = QTimer(self)
        self.from_time_updater = True
        self.is_date_changed = False

        self.current_zone = ""

        self.tz_dict = {}
        self.continents = []
        self.countries = []

        for country, data in yali.localedata.locales.items():
            if country == ctx.consts.lang:
                if data.has_key("timezone"):
                    ctx.installData.timezone = data["timezone"]

        # Append continents and countries the time zone dictionary
        self.createTZDictionary()

        # Sort continent list
        self.sortContinents()

        # Append sorted continents to combobox
        self.loadContinents()

        # Load current continents country list
        self.getCountries(self.current_zone["continent"])

        # Highlight the current zone
        self.index = self.ui.continentList.findText(
            self.current_zone["continent"])
        self.ui.continentList.setCurrentIndex(self.index)

        self.index = self.ui.countryList.findText(self.current_zone["country"])
        self.ui.countryList.setCurrentIndex(self.index)

        # Initialize widget signal and slots
        self.__initSignals__()

        self.ui.calendarWidget.setDate(QDate.currentDate())

        self.pthread = None
        self.pds_messagebox = PMessageBox(self)
        self.pds_messagebox.enableOverlay()

        self.timer.start(1000)
Exemplo n.º 11
0
    def __init__(self):
        QWidget.__init__(self)
        self.ui = Ui_DateTimeWidget()
        self.ui.setupUi(self)
        self.timer = QTimer(self)
        self.from_time_updater = True
        self.is_date_changed = False

        self.current_zone = ""

        self.tz_dict = {}
        self.continents = []
        self.countries = []

        for country, data in yali.localedata.locales.items():
            if country == ctx.consts.lang:
                if data.has_key("timezone"):
                    ctx.installData.timezone = data["timezone"]

        # Append continents and countries the time zone dictionary
        self.createTZDictionary()

        # Sort continent list
        self.sortContinents()

        # Append sorted continents to combobox
        self.loadContinents()

        # Load current continents country list
        self.getCountries(self.current_zone["continent"])

        # Highlight the current zone
        self.index = self.ui.continentList.findText(self.current_zone["continent"])
        self.ui.continentList.setCurrentIndex(self.index)

        self.index = self.ui.countryList.findText(self.current_zone["country"])
        self.ui.countryList.setCurrentIndex(self.index)

        # Initialize widget signal and slots
        self.__initSignals__()

        self.ui.calendarWidget.setDate(QDate.currentDate())

        self.pthread = None
        self.pds_messagebox = PMessageBox(self)
        self.pds_messagebox.enableOverlay()

        self.timer.start(1000)
Exemplo n.º 12
0
    def _dialogAccepted(self):
        QApplication.setOverrideCursor(Qt.WaitCursor)

        if self._ui.history.isChecked():
            start = QDateTime.currentMSecsSinceEpoch()
            end = 0

            # QDate
            today = QDate.currentDate()
            week = today.addDays(1 - today.dayOfWeek())
            month = QDate(today.year(), today.month(), 1)

            index = self._ui.historyLength.currentIndex()
            if index == 0:  # Later Today
                end = QDateTime(today).toMSecsSinceEpoch()
            elif index == 1:  # Week
                end = QDateTime(week).toMSecsSinceEpoch()
            elif index == 2:  # Month
                end = QDateTime(month).toMSecsSinceEpoch()
            elif index == 3:  # All
                end = 0

            if end == 0:
                gVar.app.history().clearHistory()
            else:
                indexes = gVar.app.history().indexesFromTimeRange(start, end)
                gVar.app.history().deleteHistoryEntry(indexes)

        if self._ui.cookies.isChecked():
            gVar.app.cookieJar().deleteAllCookies()

        if self._ui.cache.isChecked():
            self.clearCache()

        if self._ui.databases.isChecked():
            self.clearWebDatabases()

        if self._ui.localStorage.isChecked():
            self.clearLocalStorage()

        QApplication.restoreOverrideCursor()

        self._ui.clear.setEnabled(False)
        self._ui.clear.setText(_('Done'))

        QTimer.singleShot(1000, self.close)
Exemplo n.º 13
0
 def setupUi(self, my_win):
     super().setupUi(my_win)
     self.sub_menu_inicio.aboutToShow.connect(self.volver_incio)
     self.sub_menu_registro.triggered.connect(self.mostrar_registrar_cancion)
     self.sub_meni_listado_canciones.triggered.connect(self.mostrar_listado_canciones)
     self.sub_menu_tabla_Canciones.triggered.connect(self.mostrar_tabla_canciones)
     self.sub_menu_registro_usuario.triggered.connect(self.registrar_usuario)
     
     
     #incluir fecha
     date = QDate.currentDate()
     date = str(date.toPyDate())
     self.txt_fecha.setText(date)
     
     #incluir hora
     hora = QTime.currentTime()
     hora_txt = hora.toString("hh:mm")
     self.lcdNumber.display(hora_txt)   
Exemplo n.º 14
0
    def __init__(self, categories, record=None):
        super().__init__()
        self.setupUi(self)

        self.categories = categories
        self.record = record

        self.setup()

        if self.record:
            self.budgetBox.setValue(self.record.amount)
            self.categoryBox.setCurrentText(self.record.category)
            self.typeBox.setCurrentText(self.record.type)
            self.yearBox.setCurrentText(str(self.record.year))
            self.monthBox.setCurrentIndex(self.record.month - 1)
            self.dayBox.setCurrentText(str(self.record.day))
        else:
            today = QDate.currentDate()
            self.yearBox.setCurrentText(str(today.year()))
            self.monthBox.setCurrentIndex(today.month() - 1)
Exemplo n.º 15
0
    def __init__(self, *args, **kwargs):
        super(FinanceCalendarPage, self).__init__(*args, **kwargs)
        layout = QVBoxLayout(margin=0, spacing=2)

        # 日期选择、信息展示与新增按钮
        message_button_layout = QHBoxLayout()
        self.date_edit = QDateEdit(QDate.currentDate(), dateChanged=self.getCurrentFinanceCalendar)
        self.date_edit.setDisplayFormat('yyyy-MM-dd')
        self.date_edit.setCalendarPopup(True)
        message_button_layout.addWidget(QLabel('日期:'))
        message_button_layout.addWidget(self.date_edit)
        self.network_message_label = QLabel()
        message_button_layout.addWidget(self.network_message_label)
        message_button_layout.addStretch()  # 伸缩
        message_button_layout.addWidget(QPushButton('新增', clicked=self.create_finance_calendar), alignment=Qt.AlignRight)
        layout.addLayout(message_button_layout)
        # 当前数据显示表格
        self.finance_table = FinanceCalendarTable()
        self.finance_table.network_result.connect(self.network_message_label.setText)
        layout.addWidget(self.finance_table)
        self.setLayout(layout)
Exemplo n.º 16
0
    def __init__(self, categories, transaction=None):
        super().__init__()
        self.setupUi(self)

        self.categories = categories
        self.transaction = transaction

        # List all categories
        self.categories_model = CategoryListModel()
        for cat in self.categories:
            self.categories_model.addItem(cat)
        self.categorysBox.setModel(self.categories_model)

        if self.transaction:
            self.dateEdit.setDate(self.transaction.date)
            self.amountBox.setValue(self.transaction.amount)
            self.infoEdit.setText(self.transaction.info)
            self.categorysBox.setCurrentText(self.transaction.category)
        else:
            today = QDate.currentDate()
            self.dateEdit.setDate(today)
Exemplo n.º 17
0
    def __init__(self, *args, **kwargs):
        super(SpotCommodityPage, self).__init__(*args, **kwargs)
        layout = QVBoxLayout(margin=0, spacing=2)
        # 日期选择、信息展示与新增按钮
        message_button_layout = QHBoxLayout()
        self.date_edit = QDateEdit(QDate.currentDate(), dateChanged=self.getCurrentSpotCommodity)
        self.date_edit.setDisplayFormat('yyyy-MM-dd')
        self.date_edit.setCalendarPopup(True)
        message_button_layout.addWidget(QLabel('日期:'))
        message_button_layout.addWidget(self.date_edit)
        self.network_message_label = QLabel()
        message_button_layout.addWidget(self.network_message_label)
        message_button_layout.addStretch()  # 伸缩
        message_button_layout.addWidget(QPushButton('新增', clicked=self.create_spot_table), alignment=Qt.AlignRight)
        layout.addLayout(message_button_layout)
        # 当前数据显示表格
        self.spot_table = SpotCommodityTable()
        layout.addWidget(self.spot_table)
        self.setLayout(layout)

        # 上传数据的进度条
        self.process_widget = QWidget(self)
        self.process_widget.resize(self.width(), self.height())
        process_layout = QVBoxLayout(self.process_widget)
        process_layout.addStretch()
        self.process_message = QLabel("数据上传处理中..", self.process_widget)
        process_layout.addWidget(self.process_message)
        process = QProgressBar(parent=self.process_widget)
        process.setMinimum(0)
        process.setMaximum(0)
        process.setTextVisible(False)
        process_layout.addWidget(process)
        process_layout.addStretch()
        self.process_widget.setLayout(process_layout)
        self.process_widget.hide()
        self.process_widget.setStyleSheet("background:rgb(200,200,200);opacity:0.6")
Exemplo n.º 18
0
 def __init__(self):
     super().__init__()
     self.setupUi(self)
     self.tableWidget.setColumnWidth(9, 0)
     self.dateEdit.setDate(QDate.currentDate())  # 设置日期为当天
     self.id = ""
Exemplo n.º 19
0
 def showEvent(self, ev):
     if self.selectedDate().year() == UNDEFINED_DATE.year:
         self.setSelectedDate(QDate.currentDate())
Exemplo n.º 20
0
    def init_gui(self):
        self.form_layout = QFormLayout()
        self.cmb_ods_sheets = QComboBox()
        self.le_initial_row = QLineEdit("1")
        self.le_initial_row.setValidator(QIntValidator(1, 99999))
        self.cmb_group = QComboBox()
        self.le_date_col = QLineEdit("1")
        self.le_date_col.setValidator(QIntValidator(1, 999999))
        self.default_date = QDateTimeEdit(QDate.currentDate())
        self.default_date.setMinimumDate(QDate.currentDate().addDays(-365))
        self.default_date.setMaximumDate(QDate.currentDate().addDays(365))
        self.default_date.setDisplayFormat("dd.MM.yyyy")
        self.default_date.setCalendarPopup(True)
        self.le_date_format = QLineEdit("d/M/yyyy")

        self.le_description_col = QLineEdit("2")
        self.le_description_col.setValidator(QIntValidator(1, 9999))
        self.sObj = get_splitwise()
        groups = self.sObj.getGroups()

        self.cmb_ods_sheets.currentTextChanged.connect(self.sheet_changed)
        for group in groups:
            self.cmb_group.addItem(group.getName(), group)
        self.cmb_group.currentIndexChanged.connect(self.current_group_changed)
        self.cmb_group.setCurrentIndex(0)
        btn_open_filename = QPushButton("Open")
        btn_open_filename.clicked.connect(self.open_filename)
        self.form_layout.addRow(self.tr("Archivo"), btn_open_filename)
        self.form_layout.addRow(self.tr("Hoja"), self.cmb_ods_sheets)
        self.form_layout.addRow(self.tr("Grupos"), self.cmb_group)
        self.form_layout.addRow(self.tr("Fila Inicial"), self.le_initial_row)
        self.form_layout.addRow(self.tr("Columna Fecha"), self.le_date_col)
        self.form_layout.addRow(self.tr("Formato de fecha"),
                                self.le_date_format)
        self.form_layout.addRow(self.tr("Fecha por defecto"),
                                self.default_date)
        self.form_layout.addRow(self.tr("Columna Concepto"),
                                self.le_description_col)

        self.group_members_layout = QFormLayout()

        self.btn_import = QPushButton(self.tr("Importar"))
        self.btn_import.clicked.connect(self.import_expenses)

        self.model = QStandardItemModel(self)
        tableView = QTableView(self)
        tableView.setModel(self.model)

        self.vlayout = QVBoxLayout()
        self.vlayout.addLayout(self.form_layout)
        self.vlayout.addLayout(self.group_members_layout)
        self.vlayout.addWidget(self.btn_import)
        self.vlayout.setStretch(1, 1)

        hlayout = QHBoxLayout()
        hlayout.addWidget(tableView)
        hlayout.addLayout(self.vlayout)

        hlayout.setStretch(1, 0)
        hlayout.setStretch(0, 1)
        self.setLayout(hlayout)
        self._enable_widgets(False)
        self.show()