Example #1
0
 def readCounters(self):
     """Read counters"""
     self.lblTimeSpent.setStringValue_(fh.secToTimeStr(self.tasks.timings.spentSeconds))
     self.lblSlackingTime.setStringValue_(fh.secToTimeStr(self.tasks.timings.slackingSeconds))
     self.lblTimeLeft.setStringValue_(fh.secToTimeStr(self.tasks.timings.leftSeconds))
     self.lblTimeSpentCurr.setStringValue_(fh.secToTimeStr(self.tasks.timings.currentSeconds))
     self.lblWorkTill.setStringValue_(fh.timeStructToTimeStr(self.tasks.timings.workTillTime))
 def saveSettings(self):
     Settings.set("workDayLength", fh.hoursToSeconds(self.stprWorkHours.intValue()))
     dateStr = str(self.dpkrWorkStarts.dateValue())
     Settings.set("workEndTime", dateStr[11:16])
     Settings.set("logEditCommand", self.edtLogEditCommand.stringValue())
     Settings.set("logDateTimeFormat", self.edtDateTimeFormat.stringValue())
     Settings.set("notificationTime", self.stprNotificationTime.intValue())
     Settings.set("notificationRepeatTime", self.stprNotificationRepeatTime.intValue())
     Settings.sync()
Example #3
0
 def btnDonePress_(self, sender):
     """On done button press"""
     if self.tasks.dayStarted():
         if self.cbxInput.stringValue().strip():
             taskName = self.cbxInput.stringValue()
             self.appendTask(*fh.formatTaskString(*self.tasks.add(taskName, self.pbtnProject.titleOfSelectedItem())))
             self.readCounters()
             self.cbxInput.setStringValue_("")
             self.scrollToEnd()
         
             if  Tasks.taskType(taskName) == "work":
                 Projects.addAutocomplete(self.pbtnProject.titleOfSelectedItem(), taskName)
             else:
                 SlackingAutocompletes.add(taskName)
             self.cbxInput.addItemWithObjectValue_(taskName)
     else:
         if Settings.get("showHelpMessageOnStart"):
             self.showStartHelpMessage()
         taskName = Settings.get("startPlaceholder")
         self.appendTask(*fh.formatTaskString(*self.tasks.add(taskName)))
         self.initDoneButton()
Example #4
0
 def btnDonePress_(self, sender):
     """On done button press"""
     if self.cbxInput.stringValue().strip():
         taskName = self.cbxInput.stringValue()
         self.appendTask(*fh.formatTaskString(*self.tasks.add(taskName, self.pbtnProject.titleOfSelectedItem())))
         self.readCounters()
         self.cbxInput.setStringValue_("")
         self.scrollToEnd()
         
         if  Tasks.taskType(taskName) == "work":
             Projects.addAutocomplete(self.pbtnProject.titleOfSelectedItem(), taskName)
         else:
             SlackingAutocompletes.add(taskName)
         self.cbxInput.addItemWithObjectValue_(taskName)
 def initVlaues(self):
     self.stprWorkHours.setIntValue_(fh.secToHours(Settings.get("workDayLength")))
     self.edtWorkHours.setIntValue_(self.stprWorkHours.intValue())
     
     self.stprNotificationTime.setIntValue_(Settings.get("notificationTime"))
     self.edtNotificationTime.setIntValue_(self.stprNotificationTime.intValue())
     
     self.stprNotificationRepeatTime.setIntValue_(Settings.get("notificationRepeatTime"))
     self.edtNotificationRepeatTime.setIntValue_(self.stprNotificationRepeatTime.intValue())
     
     workEndTime = datetime.datetime.strptime(Settings.get("workEndTime"), "%H:%M").time()
     someDate = datetime.datetime.combine(datetime.datetime.now(), workEndTime)
     self.dpkrWorkStarts.setDateValue_(fh.datetimeToNSDate(someDate)) 
     
     self.edtLogEditCommand.setStringValue_(Settings.get("logEditCommand"))
     
     self.chbShowWorkTill.setState_(1 if Settings.get("showWorkTill") else 0)
     self.chbShowDateTime.setState_(1 if Settings.get("showDateTime") else 0)
     self.chbShowNotification.setState_(1 if Settings.get("showNotification") else 0)
     self.chbSoundOnNotification.setState_(1 if Settings.get("soundOnNotification") else 0)
     
     self.edtDateTimeFormat.setStringValue_(Settings.get("logDateTimeFormat"))
     self.edtDateTimeFormat.setEnabled_(self.chbShowDateTime.state())
     self.showNotification_(self)
Example #6
0
 def fillTasks(self):
     """Fill text area with tasks"""
     for task in self.tasks.taskList:
         self.appendTask(*fh.formatTaskString(*task))