Skip to content

Commit

Permalink
added plasma notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
ku1ik committed Apr 27, 2009
1 parent 804457a commit 22346d5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion contents/code/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def setUsername(self, value):
self.cfg.writeEntry('username', value.trimmed())

def getActivitiesNumber(self):
return self.cfg.readEntry('activitiesNumber', QVariant(3)).toInt()[0]
return 3 #self.cfg.readEntry('activitiesNumber', QVariant(3)).toInt()[0]

def setActivitiesNumber(self, value):
self.cfg.writeEntry('activitiesNumber', QVariant(int(value)))
Expand Down
29 changes: 14 additions & 15 deletions contents/code/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,7 @@ def createLayout(self):

# header (flash + logo)
headerLayout = QGraphicsLinearLayout(Qt.Horizontal)
label = Plasma.Label()
label.setText("")
label.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Ignored)
headerLayout.addItem(label)
headerLayout.addItem(Plasma.Label())
pixmap = QPixmap(os.path.dirname(__file__) + "/../logo-small.png")
pixmapWidget = QGraphicsPixmapWidget(pixmap)
pixmapWidget.setMinimumSize(pixmap.width(), pixmap.height())
Expand Down Expand Up @@ -142,11 +139,11 @@ def createLayout(self):
label.setPreferredSize(60, 0)
label.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Ignored)
dateLayout.addItem(label)
date = KDateWidget()
date.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
date.setAttribute(Qt.WA_NoSystemBackground)
self.date = KDateWidget()
self.date.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
self.date.setAttribute(Qt.WA_NoSystemBackground)
dateWidget = QGraphicsProxyWidget()
dateWidget.setWidget(date)
dateWidget.setWidget(self.date)
dateLayout.addItem(dateWidget)
newActivityLayout.addItem(dateLayout)

Expand Down Expand Up @@ -236,7 +233,6 @@ def setupTimers(self):


def fetchActivities(self):
# print int(self.cfg.activitiesNumber)
return self.makeRequest('/activities?' + urllib.urlencode({ 'search_criteria[limit]': self.cfg.activitiesNumber }))


Expand All @@ -245,10 +241,11 @@ def fetchProjects(self):


def postActivity(self):
activity = {}
data = urllib.urlencode({ 'activity[date]': activity['date'], 'activity[project_id]': activity['project_id'],
'activity[hours]': activity['hours'], 'activity[comments]': activity['comments'] })
return self.makeRequest('/activities', data)
projectName = self.projectNameCombo.text()
projectId = [id for id in self.projects if self.projects[id] == projectName][0]
# data = urllib.urlencode({ 'activity[date]': str(self.date.date().toString(Qt.ISODate), 'activity[project_id]': projectId,
# 'activity[hours]': activity['hours'], 'activity[comments]': activity['comments'] })
# return self.makeRequest('/activities', data)


def makeRequest(self, path, data=None):
Expand Down Expand Up @@ -329,10 +326,12 @@ def afternoonCheck(self):

def showFlash(self, msg):
print "flash: " + msg
# self.flash.flash(msg)
self.sendNotification(msg, 10000)


def sendNotification(self, body):
# self.notificationsProxy.Notify('rubytime-plasmoid', 0, "someid", 'folder-red', 'Rubytime', body, [], [], 2000, dbus_interface='org.kde.VisualNotifications')
def sendNotification(self, body, timeout=0):
self.notificationsProxy.Notify('rubytime-plasmoid', 0, "someid", 'folder-red', 'Rubytime', str(body), [], [], timeout, dbus_interface='org.kde.VisualNotifications')
#self.notifications.Notify('rubytime-plasmoid', 0, str(random.random() * 10), 'folder-red', 'Rubytime', body, [], [], 0, dbus_interface='org.kde.VisualNotifications')
pass

Expand Down

0 comments on commit 22346d5

Please sign in to comment.