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 __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_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)
    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 __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.º 6
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())
Exemplo n.º 7
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.º 8
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 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 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 __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.º 12
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)
    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.º 14
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)
Exemplo n.º 15
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.º 16
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.º 17
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 __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 __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_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())
    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.º 22
0
    def parse(self, html):
        html = html.lower()

        try:
            # attempt to sanitize teh html
            html = html.replace(' ', '')
            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
Exemplo n.º 23
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.º 24
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.º 25
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())
    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.º 27
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.º 28
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.º 29
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.º 30
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.º 31
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.º 32
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.º 33
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.º 34
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.º 35
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.º 36
0
 def changeDate(self, date=QDate.currentDate()):
     '''Actions to conduct when date is changed, e.g. check if date exists in
     database, load existing food log'''
        
     self.foodLogModel = FoodLogModel(self.db, date, self)
     self.foodLogToday.setModel(self.foodLogModel)
Exemplo n.º 37
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.º 38
0
    def setupUi(self, MainWindow):

        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(810, 492)

        lbMinWidth = 65
        lbMinWidthLogin = 110
        # leMinWidth = 200

        # 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_presets_layout = QHBoxLayout()
        login_gbox_server_layout = QHBoxLayout()
        login_gbox_ssl_layout = QHBoxLayout()
        login_gbox_address_layout = QHBoxLayout()
        login_gbox_pass_layout = QHBoxLayout()
        login_gbox_connect_layout = QHBoxLayout()
        login_gbox_layout.addLayout(login_gbox_presets_layout)
        login_gbox_layout.addLayout(login_gbox_server_layout)
        login_gbox_layout.addLayout(login_gbox_ssl_layout)
        login_gbox_layout.addLayout(login_gbox_address_layout)
        login_gbox_layout.addLayout(login_gbox_pass_layout)
        login_gbox_layout.addLayout(login_gbox_connect_layout)

        self.lb_presets = QLabel(self.login_gbox)
        self.lb_presets.setObjectName("lb_presets")
        self.lb_presets.setMinimumWidth(lbMinWidthLogin)
        self.lb_presets.setMaximumWidth(lbMinWidthLogin)
        self.presets_cbox = QComboBox(self.login_gbox)
        self.presets_cbox.setObjectName("presets_cbox")
        self.add_preset_btn = QPushButton(self.login_gbox)
        self.add_preset_btn.setObjectName("add_preset_btn")
        self.add_preset_btn.setMaximumWidth(30)
        self.remove_preset_btn = QPushButton(self.login_gbox)
        self.remove_preset_btn.setObjectName("remove_preset_btn")
        self.remove_preset_btn.setMaximumWidth(20)
        login_gbox_presets_layout.addWidget(self.lb_presets)
        login_gbox_presets_layout.addWidget(self.presets_cbox)
        login_gbox_presets_layout.addWidget(self.add_preset_btn)
        login_gbox_presets_layout.addWidget(self.remove_preset_btn)

        self.lb_imap_server = QLabel(self.login_gbox)
        self.lb_imap_server.setObjectName("lb_imap_server")
        self.lb_imap_server.setMinimumWidth(lbMinWidthLogin)
        self.imap_server_le = QLineEdit(self.login_gbox)
        self.imap_server_le.setObjectName("imap_server_le")
        login_gbox_server_layout.addWidget(self.lb_imap_server)
        login_gbox_server_layout.addWidget(self.imap_server_le)

        self.lb_ssl = QLabel(self.login_gbox)
        self.lb_ssl.setObjectName("lb_ssl")
        self.lb_ssl.setMinimumWidth(lbMinWidthLogin)
        self.lb_ssl.setMaximumWidth(lbMinWidthLogin)
        self.ssl_cb = QCheckBox(self.login_gbox)
        self.ssl_cb.setEnabled(False)
        self.ssl_cb.setCheckable(True)
        self.ssl_cb.setChecked(True)
        self.ssl_cb.setObjectName("ssl_cb")
        login_gbox_ssl_layout.addWidget(self.lb_ssl)
        login_gbox_ssl_layout.addWidget(self.ssl_cb)

        self.lb_adress = QLabel(self.login_gbox)
        self.lb_adress.setObjectName("lb_adress")
        self.lb_adress.setMinimumWidth(lbMinWidthLogin)
        self.adress_le = QLineEdit(self.login_gbox)
        self.adress_le.setInputMethodHints(Qt.ImhNone)
        self.adress_le.setObjectName("adress_le")
        login_gbox_address_layout.addWidget(self.lb_adress)
        login_gbox_address_layout.addWidget(self.adress_le)

        self.lb_pass = QLabel(self.login_gbox)
        self.lb_pass.setObjectName("lb_pass")
        self.lb_pass.setMinimumWidth(lbMinWidthLogin)
        self.pass_le = QLineEdit(self.login_gbox)
        self.pass_le.setText("")
        self.pass_le.setEchoMode(QLineEdit.Password)
        self.pass_le.setObjectName("pass_le")
        login_gbox_pass_layout.addWidget(self.lb_pass)
        login_gbox_pass_layout.addWidget(self.pass_le)

        self.connect_btn = QPushButton(self.login_gbox)
        self.connect_btn.setObjectName("connect_btn")
        login_gbox_connect_layout.addStretch()
        login_gbox_connect_layout.addWidget(self.connect_btn)

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

        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.since_date_cb = QCheckBox(self.search_gbox)
        self.since_date_cb.setObjectName("since_date_cb")
        self.since_date_cb.setMinimumWidth(lbMinWidth)
        self.since_date_cb.setMaximumWidth(lbMinWidth)
        self.since_date_edit = QDateEdit(self.search_gbox)
        self.since_date_edit.setCalendarPopup(True)
        self.since_date_edit.setObjectName("since_date_edit")
        self.since_date_edit.setDate(QDate.currentDate().addDays(-365))
        self.since_date_edit.setMaximumDate(QDate.currentDate())
        self.since_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.since_date_cb)
        search_gbox_date_layout.addWidget(self.since_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.addStretch()
        search_gbox_threads_layout.addWidget(self.html_radio)
        search_gbox_threads_layout.addWidget(self.text_radio)
        # search_gbox_threads_layout.addStretch()
        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")
        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.setObjectName("menubar")
        self.menu_file = QMenu(self.menubar)
        self.menu_file.setObjectName("menu_file")
        self.menu_about = QMenu(self.menubar)
        self.menu_about.setObjectName("menu_about")
        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.menu_file.addAction(self.action_exit)
        self.menu_about.addAction(self.action_about)
        self.menu_about.addAction(self.action_About_Qt)
        self.menubar.addAction(self.menu_file.menuAction())
        self.menubar.addAction(self.menu_about.menuAction())

        self.retranslateUi(MainWindow)
        QMetaObject.connectSlotsByName(MainWindow)
        MainWindow.setTabOrder(self.presets_cbox, self.imap_server_le)
        MainWindow.setTabOrder(self.imap_server_le, self.adress_le)
        MainWindow.setTabOrder(self.adress_le, self.pass_le)
        MainWindow.setTabOrder(self.pass_le, self.connect_btn)
        MainWindow.setTabOrder(self.connect_btn, self.log_te)
        MainWindow.setTabOrder(self.log_te, self.since_date_cb)
        MainWindow.setTabOrder(self.since_date_cb, self.since_date_edit)
        MainWindow.setTabOrder(self.since_date_edit, self.before_date_cb)
        MainWindow.setTabOrder(self.before_date_cb, self.before_date_edit)
        MainWindow.setTabOrder(self.before_date_edit, self.mailboxes_lw)
        MainWindow.setTabOrder(self.mailboxes_lw, 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.search_btn)
        MainWindow.setTabOrder(self.search_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.disconnect_btn)
        MainWindow.setTabOrder(self.disconnect_btn, self.add_preset_btn)
        MainWindow.setTabOrder(self.add_preset_btn, self.remove_preset_btn)
        MainWindow.setTabOrder(self.remove_preset_btn, self.ssl_cb)
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.setWindowModality(QtCore.Qt.NonModal)
        MainWindow.resize(380, 330)
        MainWindow.setMinimumSize(QtCore.QSize(380, 330))
        MainWindow.setMaximumSize(QtCore.QSize(380, 330))
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("../Fiverr_EmailOrderScrape/Resources/python.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        MainWindow.setWindowIcon(icon)
        MainWindow.setAutoFillBackground(False)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout = QtGui.QGridLayout(self.centralwidget)
        self.gridLayout.setObjectName("gridLayout")
        self.formLayout = QtGui.QFormLayout()
        self.formLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
        self.formLayout.setContentsMargins(0, 0, -1, -1)
        self.formLayout.setSpacing(15)
        self.formLayout.setObjectName("formLayout")
        self.label = QtGui.QLabel(self.centralwidget)
        self.label.setObjectName("label")
        self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.label)
        self.txtUsername = QtGui.QLineEdit(self.centralwidget)
        self.txtUsername.setEchoMode(QtGui.QLineEdit.Normal)
        self.txtUsername.setObjectName("txtUsername")
        self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.txtUsername)
        self.label_2 = QtGui.QLabel(self.centralwidget)
        self.label_2.setObjectName("label_2")
        self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.label_2)
        self.txtPassword = QtGui.QLineEdit(self.centralwidget)
        self.txtPassword.setEchoMode(QtGui.QLineEdit.Password)
        self.txtPassword.setObjectName("txtPassword")
        self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.txtPassword)
        self.label_3 = QtGui.QLabel(self.centralwidget)
        self.label_3.setObjectName("label_3")
        self.formLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.label_3)
        self.txtFromDate = QtGui.QDateEdit(self.centralwidget)
        self.txtFromDate.setCalendarPopup(True)
        self.txtFromDate.setObjectName("txtFromDate")
        self.txtFromDate.setDate(QDate.currentDate())
        self.formLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.txtFromDate)
        self.label_4 = QtGui.QLabel(self.centralwidget)
        self.label_4.setObjectName("label_4")
        self.formLayout.setWidget(3, QtGui.QFormLayout.LabelRole, self.label_4)
        self.txtToDate = QtGui.QDateEdit(self.centralwidget)
        self.txtToDate.setCalendarPopup(True)
        self.txtToDate.setObjectName("txtToDate")
        self.txtToDate.setDate(QDate.currentDate())
        self.formLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.txtToDate)
        self.label_5 = QtGui.QLabel(self.centralwidget)
        self.label_5.setObjectName("label_5")
        self.formLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.label_5)
        self.txtLabel = QtGui.QLineEdit(self.centralwidget)
        self.txtLabel.setObjectName("txtLabel")
        self.formLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.txtLabel)
        self.btnScrape = QtGui.QPushButton(self.centralwidget)
        self.btnScrape.setMinimumSize(QtCore.QSize(0, 40))
        self.btnScrape.setObjectName("btnScrape")
        self.formLayout.setWidget(5, QtGui.QFormLayout.FieldRole, self.btnScrape)
        self.gridLayout.addLayout(self.formLayout, 0, 0, 1, 3)
        self.label_6 = QtGui.QLabel(self.centralwidget)
        self.label_6.setTextFormat(QtCore.Qt.RichText)
        self.label_6.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
        self.label_6.setObjectName("label_6")
        self.gridLayout.addWidget(self.label_6, 3, 1, 1, 2)
        self.progressBar = QtGui.QProgressBar(self.centralwidget)
        self.progressBar.setProperty("value", 0)
        self.progressBar.setTextVisible(True)
        self.progressBar.setOrientation(QtCore.Qt.Horizontal)
        self.progressBar.setInvertedAppearance(True)
        self.progressBar.setTextDirection(QtGui.QProgressBar.TopToBottom)
        self.progressBar.setObjectName("progressBar")
        self.gridLayout.addWidget(self.progressBar, 2, 0, 1, 3)
        self.lblProgress = QtGui.QLabel(self.centralwidget)
        self.lblProgress.setObjectName("lblProgress")
        self.gridLayout.addWidget(self.lblProgress, 1, 0, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
Exemplo n.º 40
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.º 41
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)
Exemplo n.º 42
0
 def currentDate(self):
     '''Returns a QDate object with the date/time set to now'''
     return QDate.currentDate()
Exemplo n.º 43
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.º 44
0
 def setExerciseLogDate(self, date=QDate.currentDate()):
     '''Sets the date on the weight log tab to the current date'''
     self.exerciseDateEdit.setDate(date)
Exemplo n.º 45
0
 def __init__(self):
     ###
     logger.info('Inside WasteDish')
     self.wastedetail_tab_1 = QWidget()
     self.wastedetail_tab_1.setObjectName("wastedetail_tab_1")
     self.verticalLayout_9 = QVBoxLayout(self.wastedetail_tab_1)
     self.verticalLayout_9.setObjectName("verticalLayout_9")
     self.verticalLayout_8 = QVBoxLayout()
     self.verticalLayout_8.setObjectName("verticalLayout_8")
     self.horizontalLayout_12 = QHBoxLayout()
     self.horizontalLayout_12.setObjectName("horizontalLayout_12")
     self.waste_fromdate_label = QLabel(self.wastedetail_tab_1)
     self.waste_fromdate_label.setObjectName('waste_fromdate_label')
     self.horizontalLayout_12.addWidget(self.waste_fromdate_label)
     self.waste_fromdate_dateedit = QDateEdit(self.wastedetail_tab_1)
     self.waste_fromdate_dateedit.setCalendarPopup(True)
     self.waste_fromdate_dateedit.setObjectName("waste_fromdate_dateedit")
     self.horizontalLayout_12.addWidget(self.waste_fromdate_dateedit)
     self.waste_todate_label = QLabel(self.wastedetail_tab_1)
     self.waste_todate_label.setObjectName('waste_todate_label')
     self.horizontalLayout_12.addWidget(self.waste_todate_label)
     self.waste_todate_dateedit = QDateEdit(self.wastedetail_tab_1)
     self.waste_todate_dateedit.setCalendarPopup(True)
     self.waste_todate_dateedit.setObjectName("waste_todate_dateedit")
     self.waste_todate_dateedit.setMaximumDate(QDate.currentDate())
     self.horizontalLayout_12.addWidget(self.waste_todate_dateedit)
     spacerItem28 = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                QSizePolicy.Minimum)
     self.horizontalLayout_12.addItem(spacerItem28)
     self.waste_table_search_button = QPushButton(self.wastedetail_tab_1)
     self.waste_table_search_button.setObjectName(
         "waste_table_search_button")
     self.horizontalLayout_12.addWidget(self.waste_table_search_button)
     self.verticalLayout_8.addLayout(self.horizontalLayout_12)
     self.waste_table = QTableWidget(self.wastedetail_tab_1)
     self.waste_table.setObjectName("waste_table")
     self.waste_table.setColumnCount(5)
     self.waste_table.setRowCount(0)
     item = QTableWidgetItem()
     self.waste_table.setHorizontalHeaderItem(0, item)
     item = QTableWidgetItem()
     self.waste_table.setHorizontalHeaderItem(1, item)
     item = QTableWidgetItem()
     self.waste_table.setHorizontalHeaderItem(2, item)
     item = QTableWidgetItem()
     self.waste_table.setHorizontalHeaderItem(3, item)
     item = QTableWidgetItem()
     self.waste_table.setHorizontalHeaderItem(4, item)
     self.waste_table.horizontalHeader().setCascadingSectionResizes(False)
     self.waste_table.horizontalHeader().setStretchLastSection(True)
     self.waste_table.verticalHeader().setVisible(False)
     self.waste_table.verticalHeader().setCascadingSectionResizes(False)
     self.waste_table.setSortingEnabled(True)
     self.verticalLayout_8.addWidget(self.waste_table)
     self.horizontalLayout_13 = QHBoxLayout()
     self.horizontalLayout_13.setObjectName("horizontalLayout_13")
     self.waste_table_newrow_button = QPushButton(self.wastedetail_tab_1)
     self.waste_table_newrow_button.setObjectName(
         "waste_table_newrow_button")
     self.horizontalLayout_13.addWidget(self.waste_table_newrow_button)
     spacerItem29 = QSpacerItem(612, 20, QSizePolicy.Expanding,
                                QSizePolicy.Minimum)
     self.horizontalLayout_13.addItem(spacerItem29)
     self.waste_table_discard_button = QPushButton(self.wastedetail_tab_1)
     self.waste_table_discard_button.setObjectName(
         "waste_table_discard_button")
     self.horizontalLayout_13.addWidget(self.waste_table_discard_button)
     self.verticalLayout_8.addLayout(self.horizontalLayout_13)
     self.verticalLayout_9.addLayout(self.verticalLayout_8)
     ##retranslate
     self.waste_fromdate_label.setText(
         QApplication.translate("MainWindow", "From Date", None,
                                QApplication.UnicodeUTF8))
     self.waste_fromdate_dateedit.setDisplayFormat(
         QApplication.translate("MainWindow", "dd/MM/yyyy", None,
                                QApplication.UnicodeUTF8))
     self.waste_todate_label.setText(
         QApplication.translate("MainWindow", "To Date", None,
                                QApplication.UnicodeUTF8))
     self.waste_todate_dateedit.setDisplayFormat(
         QApplication.translate("MainWindow", "dd/MM/yyyy", None,
                                QApplication.UnicodeUTF8))
     self.waste_table_search_button.setText(
         QApplication.translate("MainWindow", "Search", None,
                                QApplication.UnicodeUTF8))
     self.waste_table.horizontalHeaderItem(0).setText(
         QApplication.translate("MainWindow", "Code", None,
                                QApplication.UnicodeUTF8))
     self.waste_table.horizontalHeaderItem(1).setText(
         QApplication.translate("MainWindow", "Item", None,
                                QApplication.UnicodeUTF8))
     self.waste_table.horizontalHeaderItem(2).setText(
         QApplication.translate("MainWindow", "Category", None,
                                QApplication.UnicodeUTF8))
     self.waste_table.horizontalHeaderItem(3).setText(
         QApplication.translate("MainWindow", "Quantity", None,
                                QApplication.UnicodeUTF8))
     self.waste_table.horizontalHeaderItem(4).setText(
         QApplication.translate("MainWindow", "Reason", None,
                                QApplication.UnicodeUTF8))
     self.waste_table_newrow_button.setText(
         QApplication.translate("MainWindow", "New Row", None,
                                QApplication.UnicodeUTF8))
     self.waste_table_discard_button.setText(
         QApplication.translate("MainWindow", "Discard Item", None,
                                QApplication.UnicodeUTF8))
     self.wastedetail_tab_1.setTabOrder(self.waste_fromdate_dateedit,
                                        self.waste_todate_dateedit)
     self.wastedetail_tab_1.setTabOrder(self.waste_todate_dateedit,
                                        self.waste_table_search_button)
     ###signals and slots && other stuffs
     # self.mainwindow = Ui_MainWindow  # just for the ease of finding the attributes in pycharm
     self.schedule = SchedulePurchase()
     self.suplier = BusinessParty(category='Supplier')
     self.add = AddStockInventory()
     self.item = WasteMenu()
     self.waste_fromdate_dateedit.setDate(QDate.currentDate())
     self.waste_todate_dateedit.setDate(QDate.currentDate())
     self.waste_table.setEditTriggers(QAbstractItemView.NoEditTriggers)
     self.waste_table_newrow_button.clicked.connect(self.add_new_blank_rows)
     self.waste_table_discard_button.clicked.connect(self.discard)
     self.waste_table_search_button.clicked.connect(self.search_discard)
     self.wastedetail_tab_1.setFocusPolicy(Qt.StrongFocus)
     self.wastedetail_tab_1.focusInEvent = self.load_rows