Exemplo n.º 1
0
    def __init__(self):
        super(Ui_ui_FISCAL_rGerarEspelhoMFD, self).__init__()

        self.setupUi(self)

        self.pushButtonEnviar.clicked.connect(self.on_pushButtonEnviar_clicked)
        self.pushButtonCancelar.clicked.connect(
            self.on_pushButtonCancelar_clicked)

        self.radioButtonIntervaloCOO.clicked.connect(
            self.on_radioButtonIntervaloCOO_clicked)
        self.radioButtonIntervaloDATA.clicked.connect(
            self.on_radioButtonIntervaloDATA_clicked)
        self.radioButtonIntervaloDATAM.clicked.connect(
            self.on_radioButtonIntervaloDATAM_clicked)

        self.groupBoxTipoIntervalo.setVisible(True)
        self.groupBoxIntervaloCOO.setVisible(False)
        self.groupBoxIntervaloDATA.setVisible(False)
        self.groupBoxIntervaloDATAM.setVisible(False)
        self.groupBoxLocalDestino.setVisible(False)
        self.dateEditDATAInicial.setDate(QDate.currentDate())
        self.dateEditDATAFinal.setDate(QDate.currentDate())
        self.dateEditDATAMInicial.setDate(QDate.currentDate())
        self.dateEditDATAMFinal.setDate(QDate.currentDate())
Exemplo n.º 2
0
    def testQDate(self):
        date = datetime.date(2010, 4, 23)
        other = QDate(date)
        self.assertEqual(date.year, other.year())
        self.assertEqual(date.month, other.month())
        self.assertEqual(date.day, other.day())

        self.assertEqual(date, other.toPython())
Exemplo n.º 3
0
 def __init__(self):
     today = QDate.currentDate()
     self.start = QDate(today.year(), today.month(), 1)
     self.end = self.start.addDays(29)
     try:
         with file(USAGE_FILE_PATH, 'r') as f:
             self.json_to_usage(f.read())
     except Exception as e:
         logger.debug(e)
    def __init__(self):
        super(Ui_ui_FISCAL_rGerarSPED, self).__init__()

        self.setupUi(self)

        self.dateEditInicial.setDate(QDate.currentDate())
        self.dateEditFinal.setDate(QDate.currentDate())

        self.pushButtonEnviar.clicked.connect(self.on_pushButtonEnviar_clicked)
        self.pushButtonCancelar.clicked.connect(self.on_pushButtonCancelar_clicked)
Exemplo n.º 5
0
    def __init__(self):
        super(Ui_ui_FISCAL_rGerarSINTEGRA, self).__init__()

        self.setupUi(self)

        self.dateEditInicial.setDate(QDate.currentDate())
        self.dateEditFinal.setDate(QDate.currentDate())

        self.pushButtonEnviar.clicked.connect(self.on_pushButtonEnviar_clicked)
        self.pushButtonCancelar.clicked.connect(self.on_pushButtonCancelar_clicked)
    def __init__(self):
        super(Ui_ui_FISCAL_eMemoriaFiscal, self).__init__()

        self.setupUi(self)

        self.lineEditInicial.setVisible(False)
        self.lineEditFinal.setVisible(False)
        self.dateEditInicial.setVisible(False)
        self.dateEditFinal.setVisible(False)
        self.dateEditInicial.setDate(QDate.currentDate())
        self.dateEditFinal.setDate(QDate.currentDate())

        self.pushButtonEnviar.clicked.connect(self.on_pushButtonEnviar_clicked)
        self.pushButtonCancelar.clicked.connect(self.on_pushButtonCancelar_clicked)
Exemplo n.º 7
0
    def __init__(self):
        super(Ui_ui_FISCAL_MenuFiscal_LMFS, self).__init__()

        self.setupUi(self)

        self.radioButtonDATAM.clicked.connect(self.on_radioButtonDATAM_clicked)
        self.radioButtonCRZ.clicked.connect(self.on_radioButtonCRZ_clicked)
        self.pushButtonEnviar.clicked.connect(self.on_pushButtonEnviar_clicked)
        self.pushButtonCancelar.clicked.connect(
            self.on_pushButtonCancelar_clicked)

        self.groupBoxIntervaloDataM.setVisible(False)
        self.groupBoxIntervaloCRZ.setVisible(False)
        self.dateEditInicial.setDate(QDate.currentDate())
        self.dateEditFinal.setDate(QDate.currentDate())
    def __init__(self):
        super(Ui_ui_FISCAL_eMemoriaFiscal, self).__init__()

        self.setupUi(self)

        self.lineEditInicial.setVisible(False)
        self.lineEditFinal.setVisible(False)
        self.dateEditInicial.setVisible(False)
        self.dateEditFinal.setVisible(False)
        self.dateEditInicial.setDate(QDate.currentDate())
        self.dateEditFinal.setDate(QDate.currentDate())

        self.pushButtonEnviar.clicked.connect(self.on_pushButtonEnviar_clicked)
        self.pushButtonCancelar.clicked.connect(
            self.on_pushButtonCancelar_clicked)
    def createEditor(self, parent, option, index):
        if not index.isValid():
            return QSqlRelationalDelegate.createEditor(self, parent, option,
                                                       index)

        if index.column() in self.__read_only:
            return None
        elif index.column() in self.__dates:
            return QDateEdit(QDate.currentDate(), parent)
        elif index.column() in self.__booleens:
            editor = QCheckBox("", parent)
            r = self.checkBoxRect(option, editor)
            rect = option.rect
            rect.moveTo(r.x(), r.y())
            rect.setWidth(r.width())
            rect.setHeight(r.height())
            editor.setGeometry(rect)
            editor.setAutoFillBackground(True)
            return editor
        elif index.column() in self.__numbers:
            editor = QSpinBox(parent)
            editor.setMinimum(0)
            editor.setMaximum(100)
            return editor
        return QSqlRelationalDelegate.createEditor(self, parent, option, index)
    def loadInfo(self, id):
        print "id =", id, "...", len(id)
        if id != '':
            info = DatabaseManager.db.getEmployeeInfo(id)
            _, name, designation, originalPay, originalPayGrade, doj, pan = info
            # self.designation.setText(str(designation))
            self.nameEdit.setText(name)
            self.designation.setCurrentIndex(self.designation.findText(str(designation)))
            self.originalPay.setText(str(originalPay))
            self.originalPayGrade.setText(str(originalPayGrade))
            # self.DOJ.setText("%02d/%02d/%4d" % (doj.day, doj.month, doj.year))
            self.DOJ.setDate(QDate(doj.year, doj.month, doj.day))
            self.pan.setText(str(pan))

            self.nameEdit.setReadOnly(False)
            self.originalPay.setReadOnly(False)
            self.originalPayGrade.setReadOnly(False)
            self.DOJ.setReadOnly(False)
            self.pan.setReadOnly(False)
            # reload stylesheet to refelect changes of readonly
            self.nameEdit.setStyle(self.style())
            self.originalPay.setStyle(self.style())
            self.originalPayGrade.setStyle(self.style())
            self.DOJ.setStyle(self.style())
            self.pan.setStyle(self.style())
Exemplo n.º 11
0
    def setTodoStartDate(self, year, month, day):
        orig_time = self._todo.startDateTime().time()
        date = QDate(year, month, day)
        datetime = QDateTime(date, orig_time)

        self._todo.setStartDateTime(datetime)
        self.currentTodoChanged.emit()
    def createEditor(self, parent, option, index):
        if not index.isValid():
            return QSqlRelationalDelegate.createEditor(self, parent,
                    option, index)

        if index.column() in self.__read_only:
            return None
        elif index.column() in self.__dates:
            return QDateEdit(QDate.currentDate(), parent)
        elif index.column() in self.__booleens:
            editor = QCheckBox("", parent)
            r = self.checkBoxRect(option, editor)
            rect = option.rect
            rect.moveTo(r.x(), r.y())
            rect.setWidth(r.width())
            rect.setHeight(r.height())
            editor.setGeometry(rect)
            editor.setAutoFillBackground(True)
            return editor
        elif index.column() in self.__numbers:
            editor = QSpinBox(parent)
            editor.setMinimum(0)
            editor.setMaximum(100)
            return editor
        return QSqlRelationalDelegate.createEditor(self, parent,
                option, index)
Exemplo n.º 13
0
 def __init__(self, parent):
     super(PnLFilter, self).__init__()
     self.parent = parent
     self.layout = QtGui.QGridLayout(self)
     #lblFromDate
     self.lblFromDate = QLabel("From Date")
     self.lblFromDate.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
     self.layout.addWidget(self.lblFromDate, 1, 0)
     #dateFromDate
     self.dateFromDate = QDateEdit(self)
     self.dateFromDate.setDisplayFormat("dd-MM-yyyy")
     self.dateFromDate.setDate(date(2018, 1, 1))
     self.dateFromDate.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
     self.layout.addWidget(self.dateFromDate, 1, 1)
     #lblToDate
     self.lblToDate = QLabel("To Date")
     self.lblToDate.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
     self.layout.addWidget(self.lblToDate, 2, 0)
     #dateToDate
     self.dateToDate = QDateEdit(self)
     self.dateToDate.setDisplayFormat("dd-MM-yyyy")
     self.dateToDate.setDate(QDate.currentDate())
     self.dateToDate.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
     self.layout.addWidget(self.dateToDate, 2, 1)
     #btnSubmit
     self.btnSubmit = QPushButton("Submit", self)
     self.btnSubmit.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
     self.layout.addWidget(self.btnSubmit)
     self.setFixedSize(190, 100)
     self.initListener()
Exemplo n.º 14
0
def readCalendar():
    date = QDate.currentDate()

    monthsRome = [
        "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI",
        "XII"
    ]
    dateRome = str(date.day()) + " " + monthsRome[date.month() - 1] + ";"

    forenames = ""
    forenamesNum = 0
    with open(FORENAMES_FILE, encoding='utf-8') as f:
        for line in f:
            if line.count(dateRome):
                if forenamesNum:
                    forenames += ", "
                if forenamesNum == 2:
                    forenames += "\n"

                forenamesNum += 1
                forenames += line.split()[0]

    if forenamesNum == 0:
        forenames = "-"

    holidayFile = HOLIDAY_FILE_PART + str(date.year()) + ".txt"
    holiday = ""
    with open(holidayFile, encoding='utf-8') as f:
        for line in f:
            if line.count(dateRome):
                holiday = line.split(";")[1].strip()

    return forenames, holiday
    def paint(self, painter, option, index):
        painter.save()
        if not index.isValid():
            QSqlRelationalDelegate.paint(self, painter, option, index)

        if index.column() in self.__dates:
            value = QDate.fromString(index.model().data(index, Qt.DisplayRole),
                                     Qt.ISODate)
            value = value.toString(Qt.SystemLocaleLongDate)
            align = Qt.AlignHCenter | Qt.AlignVCenter
            if option.state and QStyle.State_Active:
                if option.state & QStyle.State_Selected:
                    palette = QPalette.HighlightedText
                else:
                    palette = QPalette.WindowText
            else:
                palette = QPalette.WindowText

            QApplication.style().drawItemText(painter, option.rect, align,
                                              option.palette, True, value,
                                              palette)
        else:
            QSqlRelationalDelegate.paint(self, painter, option, index)

        painter.restore()
Exemplo n.º 16
0
 def changeExerciseDate(self, date=QDate.currentDate()):
     """
     Actions to conduct when date is changed, e.g. check if date exists in
     database, load existing exercise log
     """
     
     self.exerciseLogModel = ExerciseLogModel(self.db, date, self)
     self.dailyExerciseLog.setModel(self.exerciseLogModel)
Exemplo n.º 17
0
def getWeekDif(first, last):
    """Returns how many weeks are between 2 given days
    first, last - tuples (weekNum, year)"""

    if first.weekNumber()[1] < last.weekNumber()[1]:
        # 28 December is chosen as indicator of the last week
        # It is not 31 December, because sometimes it is considered as the 1 week of the new year
        firstyearsum = QDate(first.year(), 12,
                             28).weekNumber()[0] - first.weekNumber()[0]
        lastyearsum = last.weekNumber()[0]
        middleyearsum = sum([
            QDate(first.weekNumber()[1] + 1 + i, 12, 28).weekNumber()[0]
            for i in range(last.weekNumber()[1] - first.weekNumber()[1] - 1)
        ])
        return firstyearsum + lastyearsum + middleyearsum
    elif first.weekNumber()[1] == last.weekNumber()[1]:
        return last.weekNumber()[0] - first.weekNumber()[0]
    def __init__(self):
        super(Ui_ui_FISCAL_iMFLerSerial, self).__init__()

        self.setupUi(self)
        self.pushButtonEnviar.clicked.connect(self.on_pushButtonEnviar_clicked)
        self.pushButtonCancelar.clicked.connect(self.on_pushButtonCancelar_clicked)

        self.radioButtonCRZ.pressed.connect(self.on_radioButtonCRZ_pressed)
        self.radioButtonDATAM.pressed.connect(self.on_radioButtonDATAM_pressed)
        self.radioButtonTipoCompleta.pressed.connect(self.on_radioButtonTipoCompleta_pressed)
        self.radioButtonTipoSimplificada.pressed.connect(self.on_radioButtonTipoSimplificada_pressed)

        self.groupBoxIntervaloDataM.setVisible(False)
        self.groupBoxIntervaloCRZ.setVisible(False)
        self.groupBoxTipoLeitura.setVisible(False)
        self.dateEditInicial.setDate(QDate.currentDate())
        self.dateEditFinal.setDate(QDate.currentDate())
Exemplo n.º 19
0
    def read_usage(self):
        self.usage_model.name = self.settings.value('name')
        self.usage_model.username = self.settings.value('username')
        self.usage_model.password = self.settings.value('password')
        self.usage_model.last_update = self.settings.value('last_update')
        self.usage_model.capKB = int(self.settings.value('cap') or 0)
        self.usage_model.totalKB = int(self.settings.value('total') or 0)

        start = self.settings.value('start')
        if not start:
            today = QDate.currentDate()
            start = QDate(today.year(), today.month(), 1)
        self.usage_model.start = start
        end = self.settings.value('end')
        if not end:
            end = start.addDays(29)
        self.usage_model.end = end
Exemplo n.º 20
0
    def _initGUI(self):
        self.layout = QVBoxLayout()
        self.form = QFormLayout()

        self.name = QLineEdit()
        self.surname = QLineEdit()

        self.birthdate = QCalendarWidget()
        self.birthdate.setGridVisible(True)
        self.birthdate.setMinimumDate(QDate(1850, 1, 1))
        self.birthdate.setMaximumDate(QDate.currentDate())

        self.male = QRadioButton("Male")
        self.male.setChecked(True)
        self.female = QRadioButton("Female")

        self.height = QDoubleSpinBox()
        self.height.setMaximum(250)
        self.height.setMinimum(50)
        self.height.setValue(165)
        self.height.setSuffix(" cm")

        self.mass = QDoubleSpinBox()
        self.mass.setMaximum(300)
        self.mass.setMinimum(20)
        self.mass.setValue(60)
        self.mass.setSuffix(" Kg")

        btnLayout = QVBoxLayout()

        self.form.addRow("Name", self.name)
        self.form.addRow("Surname", self.surname)
        self.form.addRow("Birth date", self.birthdate)

        sexLayout = QHBoxLayout()
        sexLayout.addWidget(self.male)
        sexLayout.addWidget(self.female)
        self.form.addRow("Sex", sexLayout)

        self.form.addRow("Height", self.height)
        self.form.addRow("Mass", self.mass)

        self.layout.addLayout(self.form)
        self.layout.addLayout(btnLayout)
        self.setLayout(self.layout)
    def __init__(self):
        super(Ui_ui_FISCAL_rGerarTDM, self).__init__()

        self.setupUi(self)

        self.lineEditFinal.setVisible(False)
        self.lineEditInicial.setVisible(False)
        self.dateEditFinal.setVisible(False)
        self.dateEditInicial.setVisible(False)
        self.labelInicial.setVisible(False)
        self.labelFinal.setVisible(False)
        self.dateEditInicial.setDate(QDate.currentDate())
        self.dateEditFinal.setDate(QDate.currentDate())

        self.radioButtonDATAM.clicked.connect(self.on_radioButtonDATAM_clicked)
        self.radioButtonCOO.clicked.connect(self.on_radioButtonCOO_clicked)
        self.pushButtonEnviar.clicked.connect(self.on_pushButtonEnviar_clicked)
        self.pushButtonCancelar.clicked.connect(self.on_pushButtonCancelar_clicked)
Exemplo n.º 22
0
 def __init__(self, parent):
     super(ReportMovementFilter, self).__init__()
     self.parent = parent
     self.layout = QtGui.QGridLayout(self)
     #lblFromDate
     self.lblFromDate = QLabel("From Date")
     self.lblFromDate.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
     self.layout.addWidget(self.lblFromDate, 1, 0)
     #dateFromDate
     self.dateFromDate = QDateEdit(self)
     self.dateFromDate.setDisplayFormat("dd-MM-yyyy")
     self.dateFromDate.setDate(date(2018, 1, 1))
     self.dateFromDate.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
     self.layout.addWidget(self.dateFromDate, 1, 1)
     #lblToDate
     self.lblToDate = QLabel("To Date")
     self.lblToDate.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
     self.layout.addWidget(self.lblToDate, 2, 0)
     #dateToDate
     self.dateToDate = QDateEdit(self)
     self.dateToDate.setDisplayFormat("dd-MM-yyyy")
     self.dateToDate.setDate(QDate.currentDate())
     self.dateToDate.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
     self.layout.addWidget(self.dateToDate, 2, 1)
     #lblMovementType
     self.lblMovementType = QLabel("Movement Type")
     self.layout.addWidget(self.lblMovementType, 3, 0)
     #cmdMovementType
     self.cmdMovementType = QComboBox(self)
     self.cmdMovementType.addItems(DaoReportMovement.getMovementType())
     self.cmdMovementType.setCurrentIndex(
         self.cmdMovementType.findText("ALL"))
     self.layout.addWidget(self.cmdMovementType, 3, 1)
     #lblAssetName
     self.lblAssetName = QLabel("Asset Name")
     self.layout.addWidget(self.lblAssetName, 4, 0)
     #cmdAssetName
     self.cmdAssetName = QComboBox(self)
     self.cmdAssetName.addItems(DaoReportMovement.getAssetNames())
     self.cmdAssetName.setCurrentIndex(self.cmdAssetName.findText("ALL"))
     self.layout.addWidget(self.cmdAssetName, 4, 1)
     #lblCustodyName
     self.lblCustodyName = QLabel("Custody Name")
     self.layout.addWidget(self.lblCustodyName, 5, 0)
     #cmdCustodyName
     self.cmdCustodyName = QComboBox(self)
     self.cmdCustodyName.addItems(DaoCustody().getCustodyNameList())
     self.cmdCustodyName.setCurrentIndex(
         self.cmdCustodyName.findText("ALL"))
     self.layout.addWidget(self.cmdCustodyName, 5, 1)
     #btnSubmit
     self.btnSubmit = QPushButton("Submit", self)
     self.btnSubmit.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
     self.layout.addWidget(self.btnSubmit)
     self.setFixedSize(190, 150)
     self.initListener()
Exemplo n.º 23
0
    def __init__(self, parent):
        super(Schedule, self).__init__(parent)

        self.setTitle("Scheduling")
        self.setSubTitle("Specify the next evaluation date.")

        self.calendar = QCalendarWidget(self)
        self.calendar.setMinimumDate(QDate.currentDate())

        QVBoxLayout(self).addWidget(self.calendar)
Exemplo n.º 24
0
    def changeWeightDate(self, date=QDate.currentDate()):
        """
        Actions to conduct when the weight date is changed.
        """

        weight = self.db.getWeight(date.toString('yyyy-MM-dd'))
        if weight != None:
            self.weight.setValue(weight['weight'])
        else:
            self.weight.setValue(0.0)
    def sizeHint(self, option, index):
        size = QSqlRelationalDelegate.sizeHint(self, option, index)
        if index.isValid() and index.column() in self.__dates:
            value = QDate.fromString(index.model().data(index, Qt.DisplayRole),
                 Qt.ISODate)
            value = value.toString(Qt.SystemLocaleLongDate)
            fm = QFontMetrics(QApplication.font())

            return QSize(fm.width(value) + 5, size.height())
        else:
            return size
    def __init__(self):
        super(Ui_ui_FISCAL_rGerarRelatorioBaixoNivel, self).__init__()

        self.setupUi(self)

        self.radioButtonDATAM.clicked.connect(self.on_radioButtonDATAM_clicked)
        self.radioButtonCRZ.clicked.connect(self.on_radioButtonCRZ_clicked)
        self.radioButtonCOO.clicked.connect(self.on_radioButtonCOO_clicked)
        self.pushButtonEnviar.clicked.connect(self.on_pushButtonEnviar_clicked)
        self.pushButtonCancelar.clicked.connect(self.on_pushButtonCancelar_clicked)

        self.lineEditFinal.setVisible(False)
        self.lineEditInicial.setVisible(False)
        self.dateEditFinal.setVisible(False)
        self.dateEditInicial.setVisible(False)
        self.labelInicial.setVisible(False)
        self.labelFinal.setVisible(False)
        self.lineEditRelatorios.setText("CF_Abrir+CF_Item")
        self.dateEditInicial.setDate(QDate.currentDate())
        self.dateEditFinal.setDate(QDate.currentDate())
    def sizeHint(self, option, index):
        size = QSqlRelationalDelegate.sizeHint(self, option, index)
        if index.isValid() and index.column() in self.__dates:
            value = QDate.fromString(index.model().data(index, Qt.DisplayRole),
                                     Qt.ISODate)
            value = value.toString(Qt.SystemLocaleLongDate)
            fm = QFontMetrics(QApplication.font())

            return QSize(fm.width(value) + 5, size.height())
        else:
            return size
    def __init__(self):
        super(Ui_ui_FISCAL_iMFLer, self).__init__()

        self.setupUi(self)
        self.pushButtonEnviar.clicked.connect(self.on_pushButtonEnviar_clicked)
        self.pushButtonCancelar.clicked.connect(
            self.on_pushButtonCancelar_clicked)

        self.radioButtonCRZ.pressed.connect(self.on_radioButtonCRZ_pressed)
        self.radioButtonDATAM.pressed.connect(self.on_radioButtonDATAM_pressed)
        self.radioButtonTipoCompleta.pressed.connect(
            self.on_radioButtonTipoCompleta_pressed)
        self.radioButtonTipoSimplificada.pressed.connect(
            self.on_radioButtonTipoSimplificada_pressed)

        self.groupBoxIntervaloDataM.setVisible(False)
        self.groupBoxIntervaloCRZ.setVisible(False)
        self.groupBoxTipoLeitura.setVisible(False)
        self.dateEditDATAMInicial.setDate(QDate.currentDate())
        self.dateEditDATAMFinal.setDate(QDate.currentDate())
    def __init__(self):
        super(Ui_ui_FISCAL_rGerarRelatorio, self).__init__()

        self.setupUi(self)

        self.pushButtonBaixoNivel.clicked.connect(self.on_pushButtonBaixoNivel_clicked)
        self.radioButtonDATAM.clicked.connect(self.on_radioButtonDATAM_clicked)
        self.radioButtonCRZ.clicked.connect(self.on_radioButtonCRZ_clicked)
        self.radioButtonCOO.clicked.connect(self.on_radioButtonCOO_clicked)
        self.checkBoxSINTEGRA.clicked.connect(self.on_checkBoxSINTEGRA_clicked)
        self.pushButtonEnviar.clicked.connect(self.on_pushButtonEnviar_clicked)
        self.pushButtonCancelar.clicked.connect(self.on_pushButtonCancelar_clicked)

        self.lineEditFinal.setVisible(False)
        self.lineEditInicial.setVisible(False)
        self.dateEditFinal.setVisible(False)
        self.dateEditInicial.setVisible(False)
        self.labelInicial.setVisible(False)
        self.labelFinal.setVisible(False)
        self.dateEditInicial.setDate(QDate.currentDate())
        self.dateEditFinal.setDate(QDate.currentDate())
Exemplo n.º 30
0
    def editNewTodo(self):
        """Sets the current todo to a newly created todo"""
        newTodo = QOrganizerTodo()
        newTodo.setPriority(QOrganizerItemPriority.HighPriority)
        newTodo.setStatus(QOrganizerTodoProgress.StatusNotStarted)
        currentDateTime = QDateTime(QDate.currentDate(), QTime.currentTime())
        newTodo.setStartDateTime(currentDateTime)
        newTodo.setDueDateTime(currentDateTime.addSecs(60*60))

        self._todo = newTodo
        self._todo.isNewTodo = True
        self.currentTodoChanged.emit()
Exemplo n.º 31
0
    def __init__(self):
        super(Ui_ui_FISCAL_rGerarRelatorioBaixoNivel, self).__init__()

        self.setupUi(self)

        self.radioButtonDATAM.clicked.connect(self.on_radioButtonDATAM_clicked)
        self.radioButtonCRZ.clicked.connect(self.on_radioButtonCRZ_clicked)
        self.radioButtonCOO.clicked.connect(self.on_radioButtonCOO_clicked)
        self.pushButtonEnviar.clicked.connect(self.on_pushButtonEnviar_clicked)
        self.pushButtonCancelar.clicked.connect(
            self.on_pushButtonCancelar_clicked)

        self.lineEditFinal.setVisible(False)
        self.lineEditInicial.setVisible(False)
        self.dateEditFinal.setVisible(False)
        self.dateEditInicial.setVisible(False)
        self.labelInicial.setVisible(False)
        self.labelFinal.setVisible(False)
        self.lineEditRelatorios.setText("CF_Abrir+CF_Item")
        self.dateEditInicial.setDate(QDate.currentDate())
        self.dateEditFinal.setDate(QDate.currentDate())
Exemplo n.º 32
0
    def editNewTodo(self):
        """Sets the current todo to a newly created todo"""
        newTodo = QOrganizerTodo()
        newTodo.setPriority(QOrganizerItemPriority.HighPriority)
        newTodo.setStatus(QOrganizerTodoProgress.StatusNotStarted)
        currentDateTime = QDateTime(QDate.currentDate(), QTime.currentTime())
        newTodo.setStartDateTime(currentDateTime)
        newTodo.setDueDateTime(currentDateTime.addSecs(60 * 60))

        self._todo = newTodo
        self._todo.isNewTodo = True
        self.currentTodoChanged.emit()
Exemplo n.º 33
0
    def parse(self, html):
        html = html.lower()

        try:
            # attempt to sanitize teh html
            html = html.replace('&nbsp;', '')
            html = html.replace('style=&{head};', '')
            e = [('<head', '</head>'), ('<script', '</script>'),
                 ('<!--', '-->')]
            for elem in e:
                while True:
                    begin = html.find(elem[0])
                    if begin < 0:
                        break
                    end = html.find(elem[1])
                    html = html[:begin] + html[end + len(elem[1]):]

            begin = html.find('<body')
            end = html.find('>', begin)
            html = html[:begin + 5] + html[end:]

            soup = BeautifulSoup(unicode(html),
                                 convertEntities=BeautifulSoup.HTML_ENTITIES)
            rows  = soup.findAll('table')[14]('tr')

            self.usage = []
            date = None
            timely = []
            dataKB = 0
            self.totalKB = 0
            for row in rows[1:-1]:
                tds = [td.font.contents[0] for td in row('td')[2:]]
                if not date == tds[0]:
                    if date:
                        self.totalKB += dataKB
                        self.usage.append(DailyUsage(date, dataKB, timely))
                    date = tds[0]
                    dataKB = 0
                    timely = []
                dataKB += int(tds[2])
                timely.append(tds[1:])
            if date:
                self.totalKB += dataKB
                self.usage.append(DailyUsage(date, dataKB, timely))
            with file(USAGE_FILE_PATH, 'w') as f:
                f.write(self.usage_to_json())
        except Exception as e:
            logger.debug(e)
            self._error = 'Could not get data.'
            return False

        self.last_update = QDate.currentDate()
        return True
    def __init__(self):
        super(Ui_ui_FISCAL_rGerarEspelhoMFD, self).__init__()

        self.setupUi(self)

        self.pushButtonEnviar.clicked.connect(self.on_pushButtonEnviar_clicked)
        self.pushButtonCancelar.clicked.connect(self.on_pushButtonCancelar_clicked)

        self.radioButtonIntervaloCOO.clicked.connect(self.on_radioButtonIntervaloCOO_clicked)
        self.radioButtonIntervaloDATA.clicked.connect(self.on_radioButtonIntervaloDATA_clicked)
        self.radioButtonIntervaloDATAM.clicked.connect(self.on_radioButtonIntervaloDATAM_clicked)

        self.groupBoxTipoIntervalo.setVisible(True)
        self.groupBoxIntervaloCOO.setVisible(False)
        self.groupBoxIntervaloDATA.setVisible(False)
        self.groupBoxIntervaloDATAM.setVisible(False)
        self.groupBoxLocalDestino.setVisible(False)
        self.dateEditDATAInicial.setDate(QDate.currentDate())
        self.dateEditDATAFinal.setDate(QDate.currentDate())
        self.dateEditDATAMInicial.setDate(QDate.currentDate())
        self.dateEditDATAMFinal.setDate(QDate.currentDate())
Exemplo n.º 35
0
    def miseAJour(self):
        u"""Liste les absences pouvant donner lieu à un email de rappel"""
        self._ui.cbAbsence.clear()

        # Vérification des mails à envoyer
        req = QSqlQuery()
        sql = MailSQL.construitRequeteComptage(self.__conf["duree"])
        if req.exec_(sql):
            req.next()
            nbMails = req.record().value(0)
        else:
            # TODO log
            print req.lastError().text()
            print req.lastQuery()
            print "Erreur de requête"
            return
        label = str(nbMails) + " absence"
        if nbMails == 0:
            label += " :"
            self._ui.lAbsence.setText(label)
            self._ui.leSujet.setText("")
            self._ui.teCorps.setText("")
            self.__activerUi(False)
            self._ui.pbEnvoyer.setText("Envoyer")
            return
        else:
            self.__activerUi(True)

        if nbMails > 1:
            label += "s"
        label += " :"
        self._ui.lAbsence.setText(label)

        sql = MailSQL.construitRequeteListe(self.__conf["duree"])
        if not req.exec_(sql):
            print req.lastError().text()
            print req.lastQuery()
            print "Erreur de requête"
        else:
            self.__absences = []
            while (req.next()):
                absence = {}
                rec = req.record()
                absence = {}
                absence["id"] = rec.value(0)
                absence["date"] = QDate.fromString(rec.value(1), Qt.ISODate)
                absence["nom"] = rec.value(2)
                absence["adresse"] = rec.value(3)
                self.__absences.append(absence)
                item = absence["nom"] + " le "
                item += absence["date"].toString(Qt.SystemLocaleLongDate)
                self._ui.cbAbsence.addItem(item)
Exemplo n.º 36
0
    def miseAJour(self):
        u"""Liste les absences pouvant donner lieu à un email de rappel"""
        self._ui.cbAbsence.clear()

        # Vérification des mails à envoyer
        req = QSqlQuery()
        sql = MailSQL.construitRequeteComptage(self.__conf["duree"])
        if req.exec_(sql):
            req.next()
            nbMails = req.record().value(0)
        else:
            # TODO log
            print req.lastError().text()
            print req.lastQuery()
            print "Erreur de requête"
            return
        label = str(nbMails) + " absence"
        if nbMails == 0:
            label += " :"
            self._ui.lAbsence.setText(label)
            self._ui.leSujet.setText("")
            self._ui.teCorps.setText("")
            self.__activerUi(False)
            self._ui.pbEnvoyer.setText("Envoyer")
            return
        else:
            self.__activerUi(True)

        if nbMails > 1:
            label += "s"
        label += " :"
        self._ui.lAbsence.setText(label)

        sql = MailSQL.construitRequeteListe(self.__conf["duree"])
        if not req.exec_(sql):
            print req.lastError().text()
            print req.lastQuery()
            print "Erreur de requête"
        else:
            self.__absences = []
            while (req.next()):
                absence = {}
                rec = req.record()
                absence = {}
                absence["id"] = rec.value(0)
                absence["date"] = QDate.fromString(rec.value(1), Qt.ISODate)
                absence["nom"] = rec.value(2)
                absence["adresse"] = rec.value(3)
                self.__absences.append(absence)
                item = absence["nom"] + " le "
                item += absence["date"].toString(Qt.SystemLocaleLongDate)
                self._ui.cbAbsence.addItem(item)
Exemplo n.º 37
0
    def testQDateTimeValid(self):
        '''QDataStream <<>> QDateTime - valid'''
        time = QTime(23, 23, 23)
        date = QDate(2009, 1, 1)

        self.stream << QDateTime(date, time)

        res = QDateTime()

        self.read_stream >> res
        self.assertEqual(res, QDateTime(date, time))
        self.assertTrue(res.isValid())
        self.assertFalse(res.isNull())
Exemplo n.º 38
0
    def testQDate(self):
        date = datetime.date(2010, 4, 23)
        other = QDate(date)
        self.assertEqual(date.year, other.year())
        self.assertEqual(date.month, other.month())
        self.assertEqual(date.day, other.day())

        self.assertEqual(date, other.toPython())
    def __init__(self):
        super(Ui_ui_FISCAL_rGerarRelatorio, self).__init__()

        self.setupUi(self)

        self.pushButtonBaixoNivel.clicked.connect(
            self.on_pushButtonBaixoNivel_clicked)
        self.radioButtonDATAM.clicked.connect(self.on_radioButtonDATAM_clicked)
        self.radioButtonCRZ.clicked.connect(self.on_radioButtonCRZ_clicked)
        self.radioButtonCOO.clicked.connect(self.on_radioButtonCOO_clicked)
        self.checkBoxSINTEGRA.clicked.connect(self.on_checkBoxSINTEGRA_clicked)
        self.pushButtonEnviar.clicked.connect(self.on_pushButtonEnviar_clicked)
        self.pushButtonCancelar.clicked.connect(
            self.on_pushButtonCancelar_clicked)

        self.lineEditFinal.setVisible(False)
        self.lineEditInicial.setVisible(False)
        self.dateEditFinal.setVisible(False)
        self.dateEditInicial.setVisible(False)
        self.labelInicial.setVisible(False)
        self.labelFinal.setVisible(False)
        self.dateEditInicial.setDate(QDate.currentDate())
        self.dateEditFinal.setDate(QDate.currentDate())
Exemplo n.º 40
0
    def testQDateValid(self):
        '''QDataStream <<>> QDate - valid'''
        self.stream << QDate(2012, 12, 21)

        res = QDate()

        self.read_stream >> res
        self.assertEqual(res, QDate(2012, 12, 21))
        self.assertTrue(res.isValid())
        self.assertFalse(res.isNull())
Exemplo n.º 41
0
    def testQDateNull(self):
        '''QDataStream <<>> QDate - null'''
        self.stream << QDate()

        res = QDate()

        self.read_stream >> res
        self.assertEqual(res, QDate())
        self.assertFalse(res.isValid())
        self.assertTrue(res.isNull())
Exemplo n.º 42
0
    def __init__(self, db, date=QDate.currentDate(), parent=None):
        self.date = date
        self.db = db
        super(ExerciseLogModel, self).__init__(0, 5, parent)
        headers = ['Exercise', 'Detail', 'S1', 'S2', 'S3']
        for i in range(len(headers)):
            self.setHeaderData(i, Qt.Horizontal, headers[i])

        # Load existing data
        r = db.getDate(date.toString('yyyy-MM-dd'))
        if len(r) != 0:
            # Load existing items
            self.loadExistingDate(date)
        else:
            # nothing in database yet
            pass
Exemplo n.º 43
0
    def __init__(self, db, date=QDate.currentDate(), parent=None):
        self.date = date
        self.db = db
        super(FoodLogModel, self).__init__(0, 4, parent)
        headers = ['ID', 'Food', 'portion size', 'no. of portions']
        for i in range(len(headers)):
            self.setHeaderData(i, Qt.Horizontal, headers[i])

        # Load existing data
        r = db.getDate(date.toString('yyyy-MM-dd'))
        if len(r) != 0:
            # Load existing items
            self.existingdate = True
            self.loadExistingDate(date)
        else:
            # nothing in database yet
            self.existingdate = False
Exemplo n.º 44
0
 def _initGUI(self):
     self.layout = QVBoxLayout()
     self.form = QFormLayout()
     
     self.name = QLineEdit()
     self.surname = QLineEdit()
     
     self.birthdate = QCalendarWidget()
     self.birthdate.setGridVisible(True)
     self.birthdate.setMinimumDate(QDate(1850,1,1))
     self.birthdate.setMaximumDate(QDate.currentDate())
     
     self.male = QRadioButton("Male")
     self.male.setChecked(True)
     self.female = QRadioButton("Female")
     
     self.height = QDoubleSpinBox()
     self.height.setMaximum(250)
     self.height.setMinimum(50)
     self.height.setValue(165)
     self.height.setSuffix(" cm")
     
     self.mass = QDoubleSpinBox()
     self.mass.setMaximum(300)
     self.mass.setMinimum(20)
     self.mass.setValue(60)
     self.mass.setSuffix(" Kg")
     
     btnLayout = QVBoxLayout()
     
     self.form.addRow("Name", self.name)
     self.form.addRow("Surname", self.surname)
     self.form.addRow("Birth date",self.birthdate)
     
     sexLayout = QHBoxLayout()
     sexLayout.addWidget(self.male)
     sexLayout.addWidget(self.female)
     self.form.addRow("Sex", sexLayout)
     
     self.form.addRow("Height", self.height)
     self.form.addRow("Mass", self.mass)
             
     self.layout.addLayout(self.form)
     self.layout.addLayout(btnLayout)
     self.setLayout(self.layout)
Exemplo n.º 45
0
    def createGUI(self):
        self.series = QSpinBox()
        self.series.setMinimum(1)

        self.repetitions = QSpinBox()
        self.repetitions.setMaximum(512)

        self.avgHeartRateToggle = QCheckBox()
        self.avgHeartRateToggle.toggled.connect(self._toggleHeartRateSpinBox)

        self.avgHeartRate = QSpinBox()
        self.avgHeartRate.setMinimum(30)
        self.avgHeartRate.setMaximum(250)
        self.avgHeartRate.setValue(120)
        self.avgHeartRate.setDisabled(True)

        self.dateSelector_widget = QCalendarWidget()
        self.dateSelector_widget.setMaximumDate(QDate.currentDate())

        self.addButton = QPushButton("Add pushup")
        self.addButton.setMaximumWidth(90)
        self.addButton.clicked.connect(self._createPushup)

        self.cancelButton = QPushButton("Cancel")
        self.cancelButton.setMaximumWidth(90)
        self.cancelButton.clicked.connect(self.reject)

        self.pushupForm.addRow("Series", self.series)
        self.pushupForm.addRow("Repetitions", self.repetitions)
        self.pushupForm.addRow("Store average heart rate ? ",
                               self.avgHeartRateToggle)
        self.pushupForm.addRow("Average Heart Rate", self.avgHeartRate)
        self.pushupForm.addRow("Exercise Date", self.dateSelector_widget)

        btnsLayout = QVBoxLayout()
        btnsLayout.addWidget(self.addButton)
        btnsLayout.addWidget(self.cancelButton)
        btnsLayout.setAlignment(Qt.AlignRight)

        layoutWrapper = QVBoxLayout()
        layoutWrapper.addLayout(self.pushupForm)
        layoutWrapper.addLayout(btnsLayout)

        self.setLayout(layoutWrapper)
Exemplo n.º 46
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")
Exemplo n.º 47
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")
Exemplo n.º 48
0
 def createGUI(self):
     self.series = QSpinBox()
     self.series.setMinimum(1)
     
     self.repetitions = QSpinBox()
     self.repetitions.setMaximum(512)
     
     self.avgHeartRateToggle = QCheckBox()
     self.avgHeartRateToggle.toggled.connect(self._toggleHeartRateSpinBox)
     
     self.avgHeartRate = QSpinBox()
     self.avgHeartRate.setMinimum(30)
     self.avgHeartRate.setMaximum(250)
     self.avgHeartRate.setValue(120)
     self.avgHeartRate.setDisabled(True)
     
     self.dateSelector_widget = QCalendarWidget()
     self.dateSelector_widget.setMaximumDate(QDate.currentDate())
     
     self.addButton = QPushButton("Add pushup")
     self.addButton.setMaximumWidth(90)
     self.addButton.clicked.connect(self._createPushup)
     
     self.cancelButton = QPushButton("Cancel")
     self.cancelButton.setMaximumWidth(90)
     self.cancelButton.clicked.connect(self.reject)
     
     self.pushupForm.addRow("Series", self.series)
     self.pushupForm.addRow("Repetitions", self.repetitions)
     self.pushupForm.addRow("Store average heart rate ? ", self.avgHeartRateToggle)
     self.pushupForm.addRow("Average Heart Rate", self.avgHeartRate)
     self.pushupForm.addRow("Exercise Date", self.dateSelector_widget)
     
     btnsLayout = QVBoxLayout()
     btnsLayout.addWidget(self.addButton)
     btnsLayout.addWidget(self.cancelButton)        
     btnsLayout.setAlignment(Qt.AlignRight)
     
     layoutWrapper = QVBoxLayout()
     layoutWrapper.addLayout(self.pushupForm)
     layoutWrapper.addLayout(btnsLayout)
     
     self.setLayout(layoutWrapper)        
    def setEditorData(self, editor, index):
        if not index.isValid():
            QSqlRelationalDelegate.setEditorData(self, editor, index)
            return

        if index.column() in self.__dates:
            value = QDate.fromString(index.model().data(index, Qt.DisplayRole),
                                     Qt.ISODate)
            editor.setCalendarPopup(True)
            editor.setDate(value)
        elif index.column() in self.__booleens:
            value = index.model().data(index, Qt.EditRole)
            if value == "oui":
                value = True
            else:
                value = False
            editor.setChecked(value)
        elif index.column() in self.__numbers:
            value = index.model().data(index, Qt.EditRole)
            spinBox = editor
            spinBox.setValue(value)
        else:
            QSqlRelationalDelegate.setEditorData(self, editor, index)
    def setEditorData(self, editor, index):
        if not index.isValid():
            QSqlRelationalDelegate.setEditorData(self, editor, index)
            return

        if index.column() in self.__dates:
            value = QDate.fromString(index.model().data(index, Qt.DisplayRole),
                 Qt.ISODate)
            editor.setCalendarPopup(True)
            editor.setDate(value)
        elif index.column() in self.__booleens:
            value = index.model().data(index, Qt.EditRole)
            if value == "oui":
                value = True
            else:
                value = False
            editor.setChecked(value)
        elif index.column() in self.__numbers:
            value = index.model().data(index, Qt.EditRole)
            spinBox = editor
            spinBox.setValue(value)
        else:
            QSqlRelationalDelegate.setEditorData(self, editor, index)
    def paint(self, painter, option, index):
        painter.save()
        if not index.isValid():
            QSqlRelationalDelegate.paint(self, painter, option, index)

        if index.column() in self.__dates:
            value = QDate.fromString(index.model().data(index, Qt.DisplayRole),
                 Qt.ISODate)
            value = value.toString(Qt.SystemLocaleLongDate)
            align = Qt.AlignHCenter | Qt.AlignVCenter
            if option.state and QStyle.State_Active:
                if option.state & QStyle.State_Selected:
                    palette = QPalette.HighlightedText
                else:
                    palette = QPalette.WindowText
            else:
                palette = QPalette.WindowText

            QApplication.style().drawItemText(painter, option.rect, align,
                option.palette, True, value, palette)
        else:
            QSqlRelationalDelegate.paint(self, painter, option, index)

        painter.restore()
Exemplo n.º 52
0
    def setupUi(self, MainWindow):

        lbMinWidth = 65
        # leMinWidth = 200

        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(400, 310)

        # self.centralwidget = QWidget(MainWindow)
        self.mainSplitter = QSplitter(Qt.Horizontal, MainWindow)
        self.mainSplitter.setObjectName("centralwidget")
        self.mainSplitter.setProperty("childrenCollapsible", False)
        MainWindow.setCentralWidget(self.mainSplitter)

        self.leftSplitter = QSplitter(Qt.Vertical, self.mainSplitter)
        self.leftSplitter.setProperty("childrenCollapsible", False)
        ##### login_gbox
        self.login_gbox = QGroupBox(self.leftSplitter)
        self.login_gbox.setFlat(True)
        self.login_gbox.setObjectName("login_gbox")

        login_gbox_layout = QVBoxLayout(self.login_gbox)
        login_gbox_csf_layout = QHBoxLayout()
        login_gbox_account_layout = QHBoxLayout()
        login_gbox_connect_layout = QHBoxLayout()
        login_gbox_layout.addLayout(login_gbox_csf_layout)
        login_gbox_layout.addLayout(login_gbox_account_layout)
        login_gbox_layout.addLayout(login_gbox_connect_layout)

        self.lb_client_secrets_file_path = QLabel(self.login_gbox)
        self.lb_client_secrets_file_path.setObjectName("lb_client_secrets_file_path")
        self.lb_client_secrets_file_path.setMinimumWidth(lbMinWidth)

        self.client_secrets_file_path_le = QLineEdit(self.login_gbox)
        self.client_secrets_file_path_le.setObjectName("client_secrets_file_path_le")

        self.client_secret_file_path_tBtn = QToolButton(self.login_gbox)
        self.client_secret_file_path_tBtn.setObjectName("client_secret_file_path_tBtn")

        login_gbox_csf_layout.addWidget(self.lb_client_secrets_file_path)
        login_gbox_csf_layout.addWidget(self.client_secrets_file_path_le)
        login_gbox_csf_layout.addWidget(self.client_secret_file_path_tBtn)

        self.lb_account = QLabel(self.login_gbox)
        self.lb_account.setMaximumWidth(lbMinWidth)
        self.lb_account.setObjectName("lb_account")

        self.remove_account_btn = QToolButton(self.login_gbox)
        self.remove_account_btn.setObjectName("remove_account_btn")
        self.remove_account_btn.setMinimumWidth(20)
        self.remove_account_btn.setEnabled(False)

        self.add_account_btn = QToolButton(self.login_gbox)
        self.add_account_btn.setObjectName("add_account_btn")
        self.add_account_btn.setMinimumWidth(20)

        self.accounts_cb = QComboBox(self.login_gbox)
        self.accounts_cb.setObjectName("accounts_cb")

        login_gbox_account_layout.addWidget(self.lb_account)
        login_gbox_account_layout.addWidget(self.remove_account_btn)
        login_gbox_account_layout.addWidget(self.add_account_btn)
        login_gbox_account_layout.addWidget(self.accounts_cb)

        self.lb_decryption_key = QLabel(self.login_gbox)
        self.lb_decryption_key.setObjectName("lb_decryption_key")
        self.lb_decryption_key.setMinimumWidth(lbMinWidth)
        self.lb_decryption_key.hide()

        self.decryption_key_le = QLineEdit(self.login_gbox)
        self.decryption_key_le.setEchoMode(QLineEdit.Password)
        self.decryption_key_le.setObjectName("decryption_key_le")
        self.decryption_key_le.hide()

        self.connect_btn = QPushButton(self.login_gbox)
        self.connect_btn.setEnabled(False)
        self.connect_btn.setObjectName("connect_btn")

        login_gbox_connect_layout.addWidget(self.lb_decryption_key)
        login_gbox_connect_layout.addWidget(self.decryption_key_le)
        login_gbox_connect_layout.addWidget(self.connect_btn)

        #### search_gbox
        self.search_gbox = QGroupBox(self.leftSplitter)
        self.search_gbox.setFlat(True)
        self.search_gbox.setObjectName("search_gbox")
        self.search_gbox.hide()

        search_gbox_layout = QVBoxLayout(self.search_gbox)
        search_gbox_mailbox_layout = QVBoxLayout()
        search_gbox_date_layout = QHBoxLayout()
        search_gbox_from_layout = QHBoxLayout()
        search_gbox_to_layout = QHBoxLayout()
        search_gbox_subject_layout = QHBoxLayout()
        search_gbox_threads_layout = QHBoxLayout()
        search_gbox_paramaters_layout = QHBoxLayout()

        search_gbox_layout.addLayout(search_gbox_mailbox_layout)
        search_gbox_layout.addLayout(search_gbox_date_layout)
        search_gbox_layout.addLayout(search_gbox_from_layout)
        search_gbox_layout.addLayout(search_gbox_to_layout)
        search_gbox_layout.addLayout(search_gbox_subject_layout)
        search_gbox_layout.addLayout(search_gbox_threads_layout)
        search_gbox_layout.addLayout(search_gbox_paramaters_layout)

        self.lb_select_mailbox = QLabel(self.search_gbox)
        self.lb_select_mailbox.setObjectName("lb_select_mailbox")
        self.mailboxes_lw = QListWidget(self.search_gbox)
        self.mailboxes_lw.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.mailboxes_lw.setSelectionMode(QAbstractItemView.ExtendedSelection)
        self.mailboxes_lw.setObjectName("mailboxes_lw")
        search_gbox_mailbox_layout.addWidget(self.lb_select_mailbox)
        search_gbox_mailbox_layout.addWidget(self.mailboxes_lw)

        self.after_date_cb = QCheckBox(self.search_gbox)
        self.after_date_cb.setObjectName("after_date_cb")
        self.after_date_cb.setMinimumWidth(lbMinWidth)
        self.after_date_cb.setMaximumWidth(lbMinWidth)
        self.after_date_edit = QDateEdit(self.search_gbox)
        self.after_date_edit.setCalendarPopup(True)
        self.after_date_edit.setObjectName("after_date_edit")
        self.after_date_edit.setDate(QDate.currentDate().addDays(-365))
        self.after_date_edit.setMaximumDate(QDate.currentDate())
        self.after_date_edit.setEnabled(False)
        self.before_date_cb = QCheckBox(self.search_gbox)
        self.before_date_cb.setObjectName("before_date_cb")
        self.before_date_cb.setMinimumWidth(70)
        self.before_date_cb.setMaximumWidth(70)
        self.before_date_edit = QDateEdit(self.search_gbox)
        self.before_date_edit.setCalendarPopup(True)
        self.before_date_edit.setObjectName("before_date_edit")
        self.before_date_edit.setDate(QDate.currentDate())
        self.before_date_edit.setMaximumDate(QDate.currentDate())
        self.before_date_edit.setEnabled(False)
        search_gbox_date_layout.addWidget(self.after_date_cb)
        search_gbox_date_layout.addWidget(self.after_date_edit)
        search_gbox_date_layout.addWidget(self.before_date_cb)
        search_gbox_date_layout.addWidget(self.before_date_edit)

        self.lb_from = QLabel(self.search_gbox)
        self.lb_from.setObjectName("lb_from")
        self.lb_from.setMinimumWidth(lbMinWidth)
        self.from_le = QLineEdit(self.search_gbox)
        self.from_le.setObjectName("from_le")
        search_gbox_from_layout.addWidget(self.lb_from)
        search_gbox_from_layout.addWidget(self.from_le)

        self.lb_to = QLabel(self.search_gbox)
        self.lb_to.setObjectName("lb_to")
        self.lb_to.setMinimumWidth(lbMinWidth)
        self.to_le = QLineEdit(self.search_gbox)
        self.to_le.setObjectName("to_le")
        search_gbox_to_layout.addWidget(self.lb_to)
        search_gbox_to_layout.addWidget(self.to_le)

        self.lb_subject = QLabel(self.search_gbox)
        self.lb_subject.setObjectName("lb_subject")
        self.lb_subject.setMinimumWidth(lbMinWidth)
        self.subject_le = QLineEdit(self.search_gbox)
        self.subject_le.setObjectName("subject_le")
        search_gbox_subject_layout.addWidget(self.lb_subject)
        search_gbox_subject_layout.addWidget(self.subject_le)

        self.lb_threads = QLabel(self.search_gbox)
        self.lb_threads.setObjectName("lb_threads")
        self.lb_threads.setMaximumWidth(lbMinWidth)
        self.thread_count_sb = QSpinBox(self.search_gbox)
        self.thread_count_sb.setMinimum(1)
        self.thread_count_sb.setMaximum(10)
        self.thread_count_sb.setObjectName("thread_count_sb")
        self.html_radio = QRadioButton(self.search_gbox)
        self.html_radio.setObjectName("html_radio")
        self.text_radio = QRadioButton(self.search_gbox)
        self.text_radio.setObjectName("text_radio")
        self.extactTypeButtonGroup = QButtonGroup(self)
        self.extactTypeButtonGroup.addButton(self.html_radio)
        self.extactTypeButtonGroup.addButton(self.text_radio)
        self.html_radio.setChecked(True)
        self.search_btn = QPushButton(self.search_gbox)
        self.search_btn.setObjectName("search_btn")
        search_gbox_threads_layout.addWidget(self.lb_threads)
        search_gbox_threads_layout.addWidget(self.thread_count_sb)
        search_gbox_threads_layout.addWidget(self.html_radio)
        search_gbox_threads_layout.addWidget(self.text_radio)
        search_gbox_threads_layout.addWidget(self.search_btn)

        self.parameters_cb = QCheckBox(self.search_gbox)
        self.parameters_cb.setText("")
        self.parameters_cb.setObjectName("parameters_cb")
        self.parameters_le = QLineEdit(self.search_gbox)
        self.parameters_le.setEnabled(False)
        self.parameters_le.setObjectName("parameters_le")
        search_gbox_paramaters_layout.addWidget(self.parameters_cb)
        search_gbox_paramaters_layout.addWidget(self.parameters_le)

        #### log_gbox
        self.log_gbox = QGroupBox(self.leftSplitter)
        self.log_gbox.setFlat(True)
        self.log_gbox.setObjectName("log_gbox")
        log_layout = QVBoxLayout(self.log_gbox)
        self.log_te = QTextEdit(self.log_gbox)
        self.log_te.setLineWrapMode(QTextEdit.NoWrap)
        self.log_te.setReadOnly(True)
        self.log_te.setTextInteractionFlags(Qt.TextSelectableByKeyboard | Qt.TextSelectableByMouse)
        self.log_te.setObjectName("log_te")

        self.disconnect_btn = QPushButton(self.log_gbox)
        self.disconnect_btn.setObjectName("disconnect_btn")
        self.disconnect_btn.hide()
        log_layout.addWidget(self.log_te)
        log_layout_btn = QHBoxLayout()
        log_layout.addLayout(log_layout_btn)
        log_layout_btn.addWidget(self.disconnect_btn)
        log_layout_btn.addStretch()

        #### links_gbox
        self.links_gbox = QGroupBox(self.mainSplitter)
        self.links_gbox.setFlat(True)
        self.links_gbox.setObjectName("links_gbox")
        self.links_gbox.hide()
        links_gbox_layout = QVBoxLayout(self.links_gbox)
        links_gbox_links_layout = QVBoxLayout()
        links_gbox_buttons_layout = QHBoxLayout()
        links_gbox_layout.addLayout(links_gbox_links_layout)
        links_gbox_layout.addLayout(links_gbox_buttons_layout)

        self.links_text_edit = QTextEdit(self.links_gbox)
        self.links_text_edit.setObjectName("links_text_edit")
        links_gbox_links_layout.addWidget(self.links_text_edit)

        self.export_txt_btn = QPushButton(self.links_gbox)
        self.export_txt_btn.setObjectName("export_txt_btn")
        self.export_txt_btn.setEnabled(False)
        self.export_html_btn = QPushButton(self.links_gbox)
        self.export_html_btn.setObjectName("export_html_btn")
        self.export_html_btn.setEnabled(False)

        links_gbox_buttons_layout.addWidget(self.export_txt_btn)
        links_gbox_buttons_layout.addWidget(self.export_html_btn)
        
        ### menubar
        self.menubar = QMenuBar(MainWindow)
        # self.menubar.setGeometry(QRect(0, 0, 860, 21))
        self.menubar.setObjectName("menubar")
        self.menu_file = QMenu(self.menubar)
        self.menu_file.setObjectName("menu_file")
        self.menu_help = QMenu(self.menubar)
        self.menu_help.setObjectName("menu_help")
        MainWindow.setMenuBar(self.menubar)
        self.action_about = QAction(MainWindow)
        self.action_about.setObjectName("action_about")
        self.action_About_Qt = QAction(MainWindow)
        self.action_About_Qt.setObjectName("action_About_Qt")
        self.action_exit = QAction(MainWindow)
        self.action_exit.setObjectName("action_exit")
        self.actionSave = QAction(MainWindow)
        self.actionSave.setObjectName("actionSave")
        self.action_Gmail_Advanced_Search_Syntax = QAction(MainWindow)
        self.action_Gmail_Advanced_Search_Syntax.setObjectName("action_Gmail_Advanced_Search_Syntax")
        self.menu_file.addAction(self.action_exit)
        self.menu_help.addAction(self.action_Gmail_Advanced_Search_Syntax)
        self.menu_help.addSeparator()
        self.menu_help.addAction(self.action_about)
        self.menu_help.addAction(self.action_About_Qt)
        self.menubar.addAction(self.menu_file.menuAction())
        self.menubar.addAction(self.menu_help.menuAction())
        
        self.retranslateUi(MainWindow)
        QMetaObject.connectSlotsByName(MainWindow)
        MainWindow.setTabOrder(self.client_secrets_file_path_le, self.client_secret_file_path_tBtn)
        MainWindow.setTabOrder(self.client_secret_file_path_tBtn, self.remove_account_btn)
        MainWindow.setTabOrder(self.remove_account_btn, self.add_account_btn)
        MainWindow.setTabOrder(self.add_account_btn, self.accounts_cb)
        MainWindow.setTabOrder(self.decryption_key_le, self.connect_btn)
        MainWindow.setTabOrder(self.connect_btn, self.log_te)
        MainWindow.setTabOrder(self.log_te, self.mailboxes_lw)
        MainWindow.setTabOrder(self.mailboxes_lw, self.after_date_cb)
        MainWindow.setTabOrder(self.after_date_cb, self.after_date_edit)
        MainWindow.setTabOrder(self.after_date_edit, self.before_date_cb)
        MainWindow.setTabOrder(self.before_date_cb, self.before_date_edit)
        MainWindow.setTabOrder(self.before_date_edit, self.from_le)
        MainWindow.setTabOrder(self.from_le, self.to_le)
        MainWindow.setTabOrder(self.to_le, self.subject_le)
        MainWindow.setTabOrder(self.subject_le, self.thread_count_sb)
        MainWindow.setTabOrder(self.thread_count_sb, self.html_radio)
        MainWindow.setTabOrder(self.html_radio, self.text_radio)
        MainWindow.setTabOrder(self.text_radio, self.search_btn)
        MainWindow.setTabOrder(self.search_btn, self.parameters_cb)
        MainWindow.setTabOrder(self.parameters_cb, self.parameters_le)
        MainWindow.setTabOrder(self.parameters_le, self.disconnect_btn)
        MainWindow.setTabOrder(self.disconnect_btn, self.links_text_edit)
        MainWindow.setTabOrder(self.links_text_edit, self.export_txt_btn)
        MainWindow.setTabOrder(self.export_txt_btn, self.export_html_btn)
        MainWindow.setTabOrder(self.export_html_btn, self.mailboxes_lw)
Exemplo n.º 53
0
 def setUp(self):
     self.original = QDate(2010, 11, 22)
Exemplo n.º 54
0
 def __init__(self):
     #####
     logger.info('Inside PurchaseSchedule')
     self.notificationTab_tab_4 = QWidget()
     self.notificationTab_tab_4.setObjectName("notificationTab_tab_4")
     self.gridLayout_19 = QGridLayout(self.notificationTab_tab_4)
     self.gridLayout_19.setObjectName("gridLayout_19")
     ##
     self.horizontalLayout = QHBoxLayout()
     self.horizontalLayout.setObjectName("horizontalLayout")
     self.title_label = QLabel(self.notificationTab_tab_4)
     self.title_label.setObjectName("title_label")
     self.horizontalLayout.addWidget(self.title_label)
     self.gridLayout_19.addLayout(self.horizontalLayout, 0, 0, 1, 1)
     ##
     self.horizontalLayout_6 = QHBoxLayout()
     self.horizontalLayout_6.setObjectName("horizontalLayout_6")
     self.id_label = QLabel(self.notificationTab_tab_4)
     self.id_label.setObjectName("id_label")
     self.horizontalLayout_6.addWidget(self.id_label)
     self.id_line = QLineEdit(self.notificationTab_tab_4)
     self.id_line.setObjectName("id_line")
     self.horizontalLayout_6.addWidget(self.id_line)
     self.notification_schedule_fromdate_label = QLabel(
         self.notificationTab_tab_4)
     self.notification_schedule_fromdate_label.setObjectName(
         "notification_schedule_fromdate_label")
     self.horizontalLayout_6.addWidget(
         self.notification_schedule_fromdate_label)
     self.notification_schedule_fromdate_dateedit = QDateEdit(
         self.notificationTab_tab_4)
     self.notification_schedule_fromdate_dateedit.setMaximumDate(
         QDate.currentDate())
     self.notification_schedule_fromdate_dateedit.setDate(
         QDate.currentDate())
     self.notification_schedule_fromdate_dateedit.setCalendarPopup(True)
     self.notification_schedule_fromdate_dateedit.setObjectName(
         "notification_schedule_fromdate_dateedit")
     self.horizontalLayout_6.addWidget(
         self.notification_schedule_fromdate_dateedit)
     self.notification_schedule_todate_label = QLabel(
         self.notificationTab_tab_4)
     self.notification_schedule_todate_label.setObjectName(
         "notification_schedule_todate_label")
     self.horizontalLayout_6.addWidget(
         self.notification_schedule_todate_label)
     self.notification_schedule_todate_dateedit = QDateEdit(
         self.notificationTab_tab_4)
     self.notification_schedule_todate_dateedit.setMaximumDate(
         QDate.currentDate())
     self.notification_schedule_todate_dateedit.setDate(QDate.currentDate())
     self.notification_schedule_todate_dateedit.setCalendarPopup(True)
     self.notification_schedule_todate_dateedit.setObjectName(
         "notification_schedule_todate_dateedit")
     self.horizontalLayout_6.addWidget(
         self.notification_schedule_todate_dateedit)
     self.type_label = QLabel(self.notificationTab_tab_4)
     self.type_label.setObjectName("type_label")
     self.horizontalLayout_6.addWidget(self.type_label)
     self.notification_states = QComboBox(self.notificationTab_tab_4)
     self.notification_states.setObjectName("notification_states")
     self.horizontalLayout_6.addWidget(self.notification_states)
     self.batch_label = QLabel(self.notificationTab_tab_4)
     self.batch_label.setObjectName("batch_label")
     self.horizontalLayout_6.addWidget(self.batch_label)
     self.notification_results = QComboBox(self.notificationTab_tab_4)
     self.notification_results.setObjectName("notification_results")
     self.horizontalLayout_6.addWidget(self.notification_results)
     self.gridLayout_19.addLayout(self.horizontalLayout_6, 1, 0, 1, 1)
     self.gridLayout_8 = QGridLayout()
     self.gridLayout_8.setObjectName("gridLayout_8")
     self.notification_schedule_table = QTableWidget(
         self.notificationTab_tab_4)
     self.notification_schedule_table.setObjectName(
         "notification_schedule_table")
     self.notification_schedule_table.setColumnCount(5)
     self.notification_schedule_table.setRowCount(0)
     self.notification_schedule_table.setWordWrap(True)
     item = QTableWidgetItem()
     self.notification_schedule_table.setHorizontalHeaderItem(0, item)
     item = QTableWidgetItem()
     self.notification_schedule_table.setHorizontalHeaderItem(1, item)
     item = QTableWidgetItem()
     self.notification_schedule_table.setHorizontalHeaderItem(2, item)
     item = QTableWidgetItem()
     self.notification_schedule_table.setHorizontalHeaderItem(3, item)
     item = QTableWidgetItem()
     self.notification_schedule_table.setHorizontalHeaderItem(4, item)
     self.notification_schedule_table.horizontalHeader(
     ).setCascadingSectionResizes(True)
     self.notification_schedule_table.horizontalHeader(
     ).setStretchLastSection(True)
     self.notification_schedule_table.verticalHeader().setVisible(False)
     self.notification_schedule_table.verticalHeader(
     ).setCascadingSectionResizes(True)
     self.notification_schedule_table.verticalHeader(
     ).setStretchLastSection(False)
     self.gridLayout_8.addWidget(self.notification_schedule_table, 0, 0, 1,
                                 5)
     self.notification_search_button = QPushButton(
         self.notificationTab_tab_4)
     self.notification_search_button.setObjectName(
         "notification_search_button")
     self.gridLayout_8.addWidget(self.notification_search_button, 1, 0, 1,
                                 1)
     spacerItem10 = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                QSizePolicy.Minimum)
     self.gridLayout_8.addItem(spacerItem10, 1, 2, 1, 1)
     self.notification_reset_button = QPushButton(
         self.notificationTab_tab_4)
     self.notification_reset_button.setObjectName(
         "notification_reset_button")
     self.gridLayout_8.addWidget(self.notification_reset_button, 1, 3, 1, 1)
     self.notification_load_more_button = QPushButton(
         self.notificationTab_tab_4)
     self.notification_load_more_button.setObjectName(
         "notification_load_more_button")
     self.gridLayout_8.addWidget(self.notification_load_more_button, 1, 4,
                                 1, 1)
     self.gridLayout_19.addLayout(self.gridLayout_8, 2, 0, 1, 1)
     ###retranslate
     self.title_label.setText(
         QApplication.translate(
             "MainWindow", "<html><head/><body><p align=\"center\">"
             "<span style=\" font-weight:600;font-size:20px\">"
             "<u>All Notifications</u></span></p></body></html>", None,
             QApplication.UnicodeUTF8))
     self.id_label.setText(
         QApplication.translate("MainWindow", "Message Id", None,
                                QApplication.UnicodeUTF8))
     self.notification_schedule_fromdate_label.setText(
         QApplication.translate("MainWindow", "From Date", None,
                                QApplication.UnicodeUTF8))
     self.notification_schedule_fromdate_dateedit.setDisplayFormat(
         QApplication.translate("MainWindow", "dd/MM/yyyy", None,
                                QApplication.UnicodeUTF8))
     self.notification_schedule_todate_label.setText(
         QApplication.translate("MainWindow", "To Date", None,
                                QApplication.UnicodeUTF8))
     self.notification_schedule_todate_dateedit.setDisplayFormat(
         QApplication.translate("MainWindow", "dd/MM/yyyy", None,
                                QApplication.UnicodeUTF8))
     self.type_label.setText(
         QApplication.translate("MainWindow", "Type", None,
                                QApplication.UnicodeUTF8))
     self.batch_label.setText(
         QApplication.translate("MainWindow", "Number of Notifications",
                                None, QApplication.UnicodeUTF8))
     self.notification_schedule_table.horizontalHeaderItem(0).setText(
         QApplication.translate("MainWindow", "Message Id", None,
                                QApplication.UnicodeUTF8))
     self.notification_schedule_table.horizontalHeaderItem(1).setText(
         QApplication.translate("MainWindow", "Date", None,
                                QApplication.UnicodeUTF8))
     self.notification_schedule_table.horizontalHeaderItem(2).setText(
         QApplication.translate("MainWindow", "From", None,
                                QApplication.UnicodeUTF8))
     self.notification_schedule_table.horizontalHeaderItem(3).setText(
         QApplication.translate("MainWindow", "Message", None,
                                QApplication.UnicodeUTF8))
     self.notification_schedule_table.horizontalHeaderItem(4).setText(
         QApplication.translate("MainWindow", "State", None,
                                QApplication.UnicodeUTF8))
     self.notification_search_button.setText(
         QApplication.translate("MainWindow", "Search", None,
                                QApplication.UnicodeUTF8))
     self.notification_reset_button.setText(
         QApplication.translate("MainWindow", "Reset All", None,
                                QApplication.UnicodeUTF8))
     self.notification_load_more_button.setText(
         QApplication.translate("MainWindow", "Load More", None,
                                QApplication.UnicodeUTF8))
     ##signals and slotts && other stuffs
     self.scheduletable_count = 0
     self.addtable_count = 0
     # self.mainwindow = Ui_MainWindow  # just for the ease of finding the attributes in pycharm
     self.notification_schedule_table.setEditTriggers(
         QAbstractItemView.NoEditTriggers)
     self.batch_number = None
     self.notification_results.addItems([str(i) for i in range(1, 50, 5)])
     self.notification_states.addItems(['All', 'New', 'To Do', 'Done'])
     self.message = Messaging()
     self.notification_load_more_button.clicked.connect(self.load_more)
     self.notification_search_button.clicked.connect(self.search_messages)
     self.notification_reset_button.clicked.connect(self.reset_all)
     self.notificationTab_tab_4.setFocusPolicy(Qt.StrongFocus)
     self.notificationTab_tab_4.focusInEvent = self.load_rows
Exemplo n.º 55
0
 def testDateConversion(self):
     dateTime = QDateTime(QDate(2011, 5, 17), QTime(11, 1, 14, 15))
     dateTimePy = QDateTime(datetime.date(2011, 5, 17),
                            datetime.time(11, 1, 14, 15000))
     self.assertEqual(dateTime, dateTimePy)
Exemplo n.º 56
0
import shutil
import os

from PySide.QtGui import *
from PySide.QtCore import QDate

import paths


SALT = str(QDate.currentDate().toString('ddMMyyyy'))

# Decorator maker. Input: mode - 'save' or 'load'
# Wraps the save or load function, making all the necessary file twerks before and after
def filemove(mode):
    def decorator(func):
        def wrapper(layout):
            dateadded = False
            if mode == 'save':
                if paths.savePath == '':
                        savedialog = QFileDialog()
                        savedialog.setAcceptMode(QFileDialog.AcceptSave)
                        savedialog.setDefaultSuffix('txt')
                        savedialog.exec_()
                        if savedialog.result() != QDialog.Accepted:
                            return
                        paths.savePath = savedialog.selectedFiles()[0][:-4] + 'file.txt'
                else:
                    if not os.path.isfile(os.path.basename(paths.savePath)[:-8]):
                        shutil.move(paths.savePath[:-8], os.curdir)

            elif mode == 'load':
Exemplo n.º 57
0
def fromDatetoQDate(date):
    """Returns the QDate object generated from datatime.date object"""
    return QDate.fromString(date.isoformat(), 'yyyy-MM-dd')