Beispiel #1
0
class Task(TaskBase):

    taskData = DAMGDICT()

    def __init__(self, taskID=None, taskName=None, taskMode=None, taskType=None, project=None, organisation=None,
                 duetime={}, duedate={}, details={}):
        super(Task, self).__init__()

        self.taskID     = taskID
        self.taskName   = taskName
        self.taskMode = taskMode
        self.taskType = taskType
        self.project    = project
        self.details    = details
        self.organisation = organisation

        self.duetime    = QTime(duetime['hour'], duetime['minute'], duetime['second'])
        self.duedate    = QDate(duedate['year'], duedate['month'], duedate['day'])
        self.endDate    = QDateTime(self.duedate, self.duetime)

        self.update()

        format = self.countter_format()
        self.timer.timeout.connect(self.update)
        self.timer.start(format)

    def update(self):
        self.startDate = QDateTime(self.date.currentDate(), self.time.currentTime())
        self.days = self.startDate.daysTo(self.endDate)

        self.hours = self.endDate.time().hour() - self.startDate.time().hour()
        if self.hours <= 0:
            if self.days > 0:
                self.days = self.days - 1
                self.hours = self.hours + 24

        self.minutes = self.endDate.time().minute() - self.startDate.time().minute()
        if self.minutes <= 0:
            if self.hours > 0:
                self.hours = self.hours - 1
                self.minutes = self.minutes + 60

        self.seconds = self.endDate.time().second() - self.startDate.time().second()
        if self.seconds <= 0:
            if self.minutes > 0:
                self.minutes = self.minutes - 1
                self.seconds = self.seconds + 60

        self._status = self.get_status()

        if self.days == 0:
            if self.hours == 0:
                if self.minutes == 0:
                    if self.seconds <= 30:
                        pth = os.path.join(SOUND_DIR, 'bell.wav')
                        if not self.play_alarm:
                            playsound(pth)
                            self.play_alarm = True
        if self.days != 0:
            hrs = self.hours + self.days*24
        else:
            hrs = self.hours

        countdown = '{0}:{1}:{2}'.format(hrs, self.minutes, self.seconds)
        self.countdown.emit(countdown)

        self._dateline = self.endDate.toString('dd/MM/yy - hh:mm:ss')
        self._enddate = self.endDate.date().toString('dd/MM/yy')
        self._endtime = self.endDate.time().toString('hh:mm:ss')

        self.updateData()

    def updateData(self):
        self.taskData.add('name', self.taskName)
        self.taskData.add('id', self.taskID)
        self.taskData.add('mode', self.taskMode)
        self.taskData.add('type', self.taskType)
        self.taskData.add('project', self.project)
        self.taskData.add('organisation', self.organisation)
        self.taskData.add('dateline', self._dateline)
        self.taskData.add('enddate', self._enddate)
        self.taskData.add('endtime', self._endtime)
        self.taskData.add('details', self.details)

        with open(os.path.join(TASK_DIR, '{0}.task'.format(self.taskID)), 'w') as f:
            json.dump(self.taskData, f, indent=4)

        return self.taskData

    def get_status(self):
        if self.days < 0:
            self._status = 'Overdued'
        elif self.days == 0:
            if self.hours < 0:
                self._status = 'Overdued'
            elif self.hours == 0:
                if self.minutes <= 0:
                    self._status = 'Overdued'
                else:
                    self._status = 'Urgent'
            else:
                self._status = 'Urgent'
        elif self.days <= 2:
            self._status = 'Tomorrow'
        elif self.days > 2 and self.days < 7:
            self._status = '{0} days'.format(self.days)
        elif self.days == 7:
            self._status = '1 Week'
        else:
            self._status = '{0} days'.format(self.days)

        return self._status

    def dateline(self):
        return self._dateline

    def enddate(self):
        return self._enddate

    def endtime(self):
        return self._endtime

# -------------------------------------------------------------------------------------------------------------
# Created by panda on 16/11/2019 - 7:00 PM
# © 2017 - 2018 DAMGteam. All rights reserved
Beispiel #2
0
class LocalDatabase(DAMG):

    key = 'LocalDatabase'
    _dbPath = DB_PTH
    conn = lite.connect(_dbPath)
    conn.text_factory = str
    cur = conn.cursor()
    tableNames = DAMGLIST()
    tables = DAMGDICT()
    db_types = DB_ATTRIBUTE_TYPE

    def __init__(self):
        super(LocalDatabase, self).__init__(self)

        self.date = DAMGDATE()
        self.time = DAMGTIMER()
        self.update()

    def update(self):
        self.tableNames = self.tableList()
        for table in self.tableNames:
            columnLst = self.columnList(table)
            self.tables.add(table, columnLst)
        self.tables.update()
        return self.tables

    def remove_data(self, tableName):
        self.cur.execute("SELECT * FROM {0}".format(tableName))
        self.cur.fetchall()
        self.cur.execute("DELETE FROM {0}".format(tableName))
        self.conn.commit()
        return

    def timelog(self, details):
        self.username, token, cookie, remember = self.query_table("curUser")
        time = self.time.currentTime()
        date = self.date.currentDate()

        self.cur.execute(
            "INSERT INTO timelog (username, time, date, details) VALUES (?,?,?,?)",
            (self.username, time, date, details))
        self.conn.commit()
        return

    def update_table(self, tableName, values):
        columns = self.columnList(tableName)
        prefix = "INSERT INTO {0}".format(tableName)
        midfix = "VALUES"

        cmd = ""
        vcmd = ""
        for i in range(len(columns)):
            cmd += columns[i] + ", "
            vcmd += values[i] + ", "
        command = "{0} ({1}) {2} ({3})".format(prefix, cmd, midfix, vcmd)
        self.cur.execute("{0}".format(command))
        self.conn.commit()
        return

    def columnList(self, tableName):
        result = self.cur.execute(
            "PRAGMA table_info({0})".format(tableName)).fetchall()
        columnLst = list(zip(*result))[1]
        return columnLst

    def tableList(self):
        result = self.cur.execute(
            "SELECT name FROM sqlite_master WHERE type='table';").fetchall()
        if result == []:
            table_names = result
        else:
            table_names = sorted(list(zip(*result))[0])
        return table_names

    def query_table(self, tableName="curUser"):
        self.cur.execute("SELECT * FROM {0}".format(tableName))
        data = self.cur.fetchall()
        return list(data[0])

    def generate_command(self, tableDetails):
        columnLst = [c for c in tableDetails.keys()]
        cmd = ""
        for i in range(len(columnLst)):
            column_name = columnLst[i]
            attribute_key = tableDetails[columnLst[i]]
            column_attribute = self.db_types[attribute_key]
            cmd += "{0} {1}".format(column_name, column_attribute)
        cmd = cmd[:-2]
        return cmd

    def create_table(self, tableName, tableDetails):
        cmd = self.generate_command(tableDetails)
        self.cur.execute("CREATE TABLE IF NOT EXISTS `{0}` ({1})".format(
            tableName, cmd))
        self.conn.commit()
        self.update()
        return

    def remove_table(self, tableName):
        self.cur.execute('DROP TABLE {0}'.format(tableName))
        self.conn.commit()
        self.update()
        return

    def create_foreign(self, id_name, table_name):
        value = 'INTERGER, FOREIGN KEY ({0}) REFERENCES {1} ({0}), '.format(
            id_name, table_name)
        return value


# -------------------------------------------------------------------------------------------------------------
# Created by panda on 3/06/2018 - 3:58 AM
# Pipeline manager - DAMGteam
Beispiel #3
0
class Signal(DAMG):

    key = 'Signal'

    _emittable = False

    # PLM class
    showLayout = pyqtSignal(str, str, name="showLayout")
    executing = pyqtSignal(str, name="executing")
    regisLayout = pyqtSignal(DAMG, name="regisLaout")
    openBrowser = pyqtSignal(str, name="openBrowser")
    setSetting = pyqtSignal(str, str, str, name="setSetting")
    sysNotify = pyqtSignal(str, str, str, int, name="sysNotify")
    loginChanged = pyqtSignal(bool, name='loginChanged')

    #
    updateAvatar = pyqtSignal(bool, name="updateAvatar")

    # Settings class
    removeGrp = pyqtSignal(str, name='removeGroup')
    setFormat = pyqtSignal(str, name='setFormat')
    setScope = pyqtSignal(str, name='setScope')

    print_emittable = False
    print_emit = False
    print_block = False
    print_checkRepeat = False
    print_getSignal = False
    print_checkState = False
    auto_changeEmmittable = True

    _signals = DAMGDICT()
    _settings = DAMGDICT()

    states = DAMGDICT()

    def __init__(self, parent):
        super(Signal, self).__init__(parent)

        self.parent = parent
        self.logger = Loggers(self.parent.key)
        self.update()

    def update(self):
        return self.updateSignals(), self.updateSettings()

    def updateState(self):
        filePth = os.path.join(TMP_DIR, '.states')
        with open(filePth, 'w') as f:
            json.dump(self.states, f, indent=4)

    def loadState(self):
        filePth = os.path.join(TMP_DIR, '.states')
        if not os.path.exists(filePth):
            self.updateState()

        with open(filePth, 'r') as f:
            data = json.load(f)
        self.states.appendDict(data)

    def updateSignals(self):
        keys = [
            'showLayout', 'executing', 'regisLayout', 'openBrowser',
            'setSetting', 'sysNotify', 'updateAvatar', 'loginChanged'
        ]
        signals = [
            self.showLayout, self.executing, self.regisLayout,
            self.openBrowser, self.setSetting, self.sysNotify,
            self.updateAvatar, self.loginChanged
        ]
        olds = [
            self.showLayoutOld, self.executingOld, self.regisLayoutOld,
            self.openBrowserOld, self.setSettingOld, self.sysNotifyOld,
            self.updateAvatarOld, self.loginChangedOld
        ]
        for i in range(len(keys)):
            key, signal, old = [keys[i], signals[i], olds[i]]
            self._signals.add(key, [signal, old])
        return self._signals

    def updateSettings(self):
        keys = [
            'emittable', 'emit', 'block', 'checkRepeat', 'getSignal',
            'checkState'
        ]
        values = [
            self.print_emittable, self.print_emit, self.print_block,
            self.print_checkRepeat, self.print_getSignal, self.print_checkState
        ]
        for i in range(len(keys)):
            self._settings.add(keys[i], values[i])
        return self._settings

    def changeSignalsSetting(self, key, value):
        self._settings[key] = value
        self._settings.update()
        return self._settings

    @property
    def signals(self):
        return self._signals

    @property
    def printCheckState(self):
        return self.print_checkState

    @property
    def autoChangeEmittable(self):
        return self.auto_changeEmmittable

    @property
    def printGetSignal(self):
        return self.print_getSignal

    @property
    def emitable(self):
        return self._emittable

    @property
    def printEmitable(self):
        return self.print_emittable

    @property
    def printEmit(self):
        return self.print_emit

    @property
    def printBlock(self):
        return self.print_block

    @property
    def printCheckRepeat(self):
        return self.print_checkRepeat

    @signals.setter
    def signals(self, val):
        self._signals = val

    @printCheckState.setter
    def printCheckState(self, val):
        self.print_checkState = val

    @autoChangeEmittable.setter
    def autoChangeEmittable(self, val):
        self.auto_changeEmmittable = val

    @printGetSignal.setter
    def printGetSignal(self, val):
        self.print_getSignal = val

    @printEmitable.setter
    def printEmitable(self, val):
        self.print_emittable = val

    @printEmit.setter
    def printEmit(self, val):
        self.print_emit = val

    @printBlock.setter
    def printBlock(self, val):
        self.print_block = val

    @printCheckRepeat.setter
    def printCheckRepeat(self, val):
        self.print_checkRepeat = val

    @emitable.setter
    def emitable(self, val):
        self._emittable = val
Beispiel #4
0
class MenuBar(QMenuBar):

    Type = 'DAMGUI'
    key = 'MenuBar'
    _name = 'DAMG Menu Bar'
    _copyright = __copyright__
    menus = DAMGDICT()

    def __init__(self, parent=None):
        super(MenuBar, self).__init__(parent)

        self.parent = parent
        self.signals = SignalManager(self)
        self.settings = Settings(SETTING_FILEPTH['app'], ST_FORMAT['ini'],
                                 self)

        self.values = dict(w=self.width(),
                           h=self.height(),
                           x=self.x(),
                           y=self.y())

    def sizeHint(self):
        size = super(MenuBar, self).sizeHint()
        size.setHeight(size.height())
        size.setWidth(max(size.width(), size.height()))
        return size

    def setValue(self, key, value):
        return self.settings.initSetValue(key, value, self.key)

    def getValue(self, key):
        return self.settings.initValue(key, self.key)

    def moveEvent(self, event):
        if self.settings._settingEnable:
            self.setValue('x', self.x())
            self.setValue('y', self.y())

    def resizeEvent(self, event):
        if self.settings._settingEnable:
            self.setValue('w', self.width())
            self.setValue('h', self.height())

    def closeEvent(self, event):
        if __name__ == '__main__':
            self.close()
        else:
            self.signals.emit('showLayout', self.key, 'hide')

    def hideEvent(self, event):
        if __name__ == '__main__':
            self.hide()
        else:
            if self.settings._settingEnable:
                for key, value in self.values.items():
                    self.setValue(key, value)
            self.signals.emit('showLayout', self.key, 'hide')

    def showEvent(self, event):

        if self.settings._settingEnable:
            w = self.getValue('w')
            h = self.getValue('h')
            x = self.getValue('x')
            y = self.getValue('x')

            vals = [w, h, x, y]

            for i in range(len(vals)):
                if vals[i] is None:
                    key = [k for k in self.values.keys()]
                    value = self.values[key[i]]
                    for index, element in enumerate(vals):
                        if element == vals[i]:
                            vals[index] = value
                    self.setValue(key[i], self.values[key[i]])

            for v in vals:
                if not type(v) in [int]:
                    v = int(v)

            self.resize(vals[0], vals[1])
            self.move(vals[2], vals[3])

        if __name__ == '__main__':
            self.show()
        else:
            self.signals.emit('showLayout', self.key, 'show')

    @property
    def copyright(self):
        return self._copyright

    @property
    def name(self):
        return self._name

    @name.setter
    def name(self, newName):
        self._name = newName
Beispiel #5
0
class HeaderCheckBoxes(GridLayout):

    key = 'HeaderCheckBoxes'
    toolBarCBs = DAMGLIST()
    menuCBs = DAMGLIST()
    connectCBs = DAMGLIST()
    checkboxes = DAMGDICT()
    def __init__(self, parent=None):
        super(HeaderCheckBoxes, self).__init__(parent)
        self.parent = parent
        self.la = 0
        self.buildHeaderCheckBoxes()

        cbs = [self.toolBarCBs, self.menuCBs, self.connectCBs, [self.headerCB]]

        for i in range(len(cbs)):
            if i == 0:
                prefix = 'ToolBar'
            elif i == 1:
                prefix = 'Menu'
            elif i == 2:
                prefix = 'Network'
            else:
                prefix = 'Header'

            for cb in cbs[i]:
                cb.key = '{0}_{1}_CheckBox_{2}'.format(self.parent.key, prefix, cb.text())
                cb._name = '{0} {1} Check Box: {2}'.format(self.parent.key, prefix, cb.text())

                cb.settings._settingEnable = True
                state = cb.getValue('checkState')
                if state is None:
                    state = True
                cb.setValue('checkState', state)
                cb.setChecked(str2bool(state))
                self.checkboxes.add(cb.key, cb)

    def buildHeaderCheckBoxes(self):
        self.buildToolBarCheckBoxes()
        self.buildMenuCheckBoxes()
        self.buildServerStatusCheckBoxes()
        self.headerCB = CheckBox('Header')
        self.headerCB.stateChanged.connect(self.headerStateChanged)

        mnl = self.la
        csl = mnl + 1
        tbl = csl + 1
        hdl = tbl + 1

        self.addWidget(Label({'txt': 'Menus'}), mnl, 0, 1, 1)
        self.addWidget(self.allMenuCB, mnl, 1, 1, 1)
        self.addWidget(self.mnAppCB, mnl, 2, 1, 1)
        self.addWidget(self.mnGoCB, mnl, 3, 1, 1)
        self.addWidget(self.mnOfficeCB, mnl, 4, 1, 1)
        self.addWidget(self.mnToolsCB, mnl, 5, 1, 1)
        self.addWidget(self.mnDevCB, mnl, 6, 1, 1)
        self.addWidget(self.mnLibCB, mnl, 7, 1, 1)
        self.addWidget(self.mnHelpCB, mnl, 8, 1, 1)

        self.addWidget(Label({'txt': 'Tool Bar: '}), tbl, 0, 1, 1)
        self.addWidget(self.allToolBarCB, tbl, 1, 1, 1)
        self.addWidget(self.tbTDCB, tbl, 2, 1, 1)
        self.addWidget(self.tbVfxCB, tbl, 3, 1, 1)
        self.addWidget(self.tbArtCB, tbl, 4, 1, 1)
        self.addWidget(self.tbTexCB, tbl, 5, 1, 1)
        self.addWidget(self.tbPostCB, tbl, 6, 1, 1)

        self.addWidget(Label({'txt': 'Connect Status'}), csl, 0, 1, 1)
        self.addWidget(self.allConnectCB, csl, 1, 1, 1)
        self.addWidget(self.serverCB, csl, 2, 1, 1)
        self.addWidget(self.onlineCB, csl, 3, 1, 1)
        self.addWidget(self.modeCB, csl, 4, 1, 1)

        self.addWidget(Label({'txt': 'Header'}), hdl, 0, 1, 1)
        self.addWidget(self.headerCB, hdl, 1, 1, 1)

    def buildServerStatusCheckBoxes(self):
        self.serverCB = CheckBox('Server')
        self.onlineCB = CheckBox('Internet')
        self.modeCB = CheckBox('Mode')
        self.allConnectCB = CheckBox("All: ")
        self.allConnectCB.stateChanged.connect(self.allConnectStateChanged)
        for cb in [self.serverCB, self.onlineCB, self.modeCB, self.allConnectCB]:
            self.connectCBs.append(cb)

    def buildMenuCheckBoxes(self):
        self.mnAppCB = CheckBox('&App')
        self.mnGoCB = CheckBox('&Go')
        self.mnOfficeCB = CheckBox('&Office')
        self.mnToolsCB = CheckBox('&Tools')
        self.mnDevCB = CheckBox('&Dev')
        self.mnLibCB = CheckBox('&Lib')
        self.mnHelpCB = CheckBox('&Help')
        self.allMenuCB = CheckBox('All: ')
        self.allMenuCB.stateChanged.connect(self.allMenuStateChanged)
        for cb in [self.mnAppCB, self.mnGoCB, self.mnOfficeCB, self.mnToolsCB, self.mnDevCB, self.mnLibCB,
                   self.mnHelpCB, self.allMenuCB]:
            self.menuCBs.append(cb)

    def buildToolBarCheckBoxes(self):
        self.tbTDCB = CheckBox("TD")
        self.tbVfxCB = CheckBox("VFX")
        self.tbArtCB = CheckBox("Art")
        self.tbTexCB = CheckBox("Tex")
        self.tbPostCB = CheckBox('Post')
        self.allToolBarCB = CheckBox("All: ")
        self.allToolBarCB.stateChanged.connect(self.allToolBarStateChanged)
        for cb in [self.tbTDCB, self.tbVfxCB, self.tbArtCB, self.tbTexCB, self.tbPostCB, self.allToolBarCB]:
            self.toolBarCBs.append(cb)

    def allToolBarStateChanged(self, bool):
        for cb in self.toolBarCBs:
            cb.setChecked(bool)

    def allMenuStateChanged(self, bool):
        for cb in self.menuCBs:
            cb.setChecked(bool)

    def allConnectStateChanged(self, bool):
        for cb in self.connectCBs:
            cb.setChecked(bool)

    def headerStateChanged(self, bool):
        self.allToolBarCB.setChecked(bool)
        self.allMenuCB.setChecked(bool)
        self.allConnectCB.setChecked(bool)
Beispiel #6
0
class GeneralSetting(GridLayout):

    key                                     = 'GeneralSetting'
    statusCBs                               = DAMGLIST()
    notificationCBs                         = DAMGLIST()
    checkboxes                              = DAMGDICT()

    def __init__(self, parent=None):
        super(GeneralSetting, self).__init__(parent)
        self.parent = parent
        self.la = 0
        self.buildUI()

    def buildUI(self):

        # self.buildHeaderCheckBoxes()

        self.buildBodyCheckBoxes()

        self.footerCB       = CheckBox('Footer')

        self.statusBarCB    = CheckBox("Status Bar")

        for cb in [self.statusBarCB, ]:
            self.statusCBs.append(cb)

        cbs = [self.toolBarCBs, self.menuCBs, self.connectCBs, self.notificationCBs, self.statusCBs, ]

        for i in range(len(cbs)):
            if i == 0:
                prefix = 'ToolBar'
            elif i == 1:
                prefix = 'Menu'
            elif i == 2:
                prefix = 'Network'
            elif i == 3:
                prefix = 'Notification'
            elif i == 4:
                prefix = 'StatusBar'
            else:
                prefix = 'NoDefine'

            for cb in cbs[i]:
                cb.key = '{0}_{1}_CheckBox_{2}'.format(self.parent.key, prefix, cb.text())
                cb._name = '{0} {1} Check Box: {2}'.format(self.parent.key, prefix, cb.text())

                cb.settings._settingEnable = True
                state = cb.getValue('checkState')
                if state is None:
                    state = True
                cb.setValue('checkState', state)
                cb.setChecked(str2bool(state))
                self.checkboxes.add(cb.key, cb)

    def buildBodyCheckBoxes(self):
        self.buildNotificationCheckBoxes()
        self.bodyCB = CheckBox('Body')
        self.bodyCB.stateChanged.connect(self.bodyStateChanged)
        ntl = self.la
        bdl = ntl + 1
        self.addWidget(Label({'txt': 'Notification'}), ntl, 0, 1, 1)
        self.addWidget(self.allNotifiCB, ntl, 1, 1, 1)
        self.addWidget(self.cpuCB, ntl, 2, 1, 1)
        self.addWidget(self.ramCB, ntl, 3, 1, 1)
        self.addWidget(self.gpuCB, ntl, 4, 1, 1)
        self.addWidget(self.prjNameCB, ntl, 5, 1, 1)
        self.addWidget(self.dueDateCB, ntl, 6, 1, 1)
        self.addWidget(self.dueTimeCB, ntl, 7, 1, 1)
        self.addWidget(self.countdownCB, ntl, 8, 1, 1)
        self.addWidget(self.timeCB, ntl, 9, 1, 1)
        self.addWidget(self.dateCB, ntl, 10, 1, 1)
        self.addWidget(self.bodyCB, bdl, 0, 1, 1)

        self.la = bdl + 1
        return self.la

    def buildNotificationCheckBoxes(self):
        self.cpuCB = CheckBox('cpu')
        self.ramCB = CheckBox('ram')
        self.gpuCB = CheckBox('gpu')
        self.diskCB = CheckBox('disk')
        self.prjNameCB = CheckBox('Project Name')
        self.dueDateCB = CheckBox('Due Date')
        self.dueTimeCB = CheckBox('Due Time')
        self.countdownCB = CheckBox('Time Counting')
        self.timeCB = CheckBox('clock')
        self.dateCB = CheckBox('date')
        self.allNotifiCB = CheckBox("All: ")
        self.allNotifiCB.stateChanged.connect(self.allNotifiStateChanged)
        for cb in [self.cpuCB, self.ramCB, self.gpuCB, self.diskCB, self.prjNameCB, self.dueDateCB, self.dueTimeCB,
                   self.countdownCB, self.timeCB, self.dateCB, self.allNotifiCB]:
            self.notificationCBs.append(cb)

    def allNotifiStateChanged(self, bool):
        for cb in self.notificationCBs:
            cb.setChecked(bool)

    def bodyStateChanged(self, bool):
        self.allNotifiStateChanged(bool)
Beispiel #7
0
class BodyCheckBoxes(GridLayout):

    key = 'BodyCheckBoxes'
    notificationCBs = DAMGLIST()
    checkboxes = DAMGDICT()

    def __init__(self, parent=None):
        super(BodyCheckBoxes, self).__init__(parent)
        self.parent = parent
        self.la = 0
        self.buildBodyCheckBoxes()

        cbs = [self.notificationCBs, [self.bodyCB]]

        for i in range(len(cbs)):
            if i == 0:
                prefix = 'Notification'
            else:
                prefix = 'Body'

            for cb in cbs[i]:
                cb.key = '{0}_{1}_CheckBox_{2}'.format(self.parent.key, prefix, cb.text())
                cb._name = '{0} {1} Check Box: {2}'.format(self.parent.key, prefix, cb.text())

                cb.settings._settingEnable = True
                state = cb.getValue('checkState')
                if state is None:
                    state = True
                cb.setValue('checkState', state)
                cb.setChecked(str2bool(state))
                self.checkboxes.add(cb.key, cb)

    def buildBodyCheckBoxes(self):
        self.buildNotificationCheckBoxes()
        self.bodyCB = CheckBox('Body')
        self.bodyCB.stateChanged.connect(self.bodyStateChanged)

        ntl = self.la
        bdl = ntl + 1

        self.addWidget(Label({'txt': 'Notification'}), ntl, 0, 1, 1)
        self.addWidget(self.allNotifiCB, ntl, 1, 1, 1)
        self.addWidget(self.cpuCB, ntl, 2, 1, 1)
        self.addWidget(self.ramCB, ntl, 3, 1, 1)
        self.addWidget(self.gpuCB, ntl, 4, 1, 1)
        self.addWidget(self.diskCB, ntl, 5, 1, 1)
        self.addWidget(self.timeCB, ntl, 6, 1, 1)
        self.addWidget(self.dateCB, ntl, 7, 1, 1)

        self.addWidget(Label({'txt': 'Body'}), bdl, 0, 1, 1)
        self.addWidget(self.bodyCB, bdl, 1, 1, 1)


        self.la = bdl + 1
        return self.la

    def buildNotificationCheckBoxes(self):
        self.cpuCB = CheckBox('cpu')
        self.ramCB = CheckBox('ram')
        self.gpuCB = CheckBox('gpu')
        self.diskCB = CheckBox('disk')
        self.timeCB = CheckBox('clock')
        self.dateCB = CheckBox('date')
        self.allNotifiCB = CheckBox("All: ")
        self.allNotifiCB.stateChanged.connect(self.allNotifiStateChanged)
        for cb in [self.cpuCB, self.ramCB, self.gpuCB, self.diskCB, self.timeCB, self.dateCB, self.allNotifiCB]:
            self.notificationCBs.append(cb)

    def allNotifiStateChanged(self, bool):
        for cb in self.notificationCBs:
            cb.setChecked(bool)

    def bodyStateChanged(self, bool):
        self.allNotifiStateChanged(bool)