hamster-applet r380 - in trunk: data hamster
- From: tbaugis svn gnome org
- To: svn-commits-list gnome org
- Subject: hamster-applet r380 - in trunk: data hamster
- Date: Sat, 16 Aug 2008 19:46:39 +0000 (UTC)
Author: tbaugis
Date: Sat Aug 16 19:46:39 2008
New Revision: 380
URL: http://svn.gnome.org/viewvc/hamster-applet?rev=380&view=rev
Log:
* removing timeout minutes slider, because we are using setting from screensaver
* on idle, if user requested, stop tracking and set end time to when idle started (bug reported on web page)
Modified:
trunk/data/hamster-applet.schemas.in
trunk/data/preferences.glade
trunk/hamster/Configuration.py
trunk/hamster/applet.py
trunk/hamster/idle.py
trunk/hamster/preferences.py
Modified: trunk/data/hamster-applet.schemas.in
==============================================================================
--- trunk/data/hamster-applet.schemas.in (original)
+++ trunk/data/hamster-applet.schemas.in Sat Aug 16 19:46:39 2008
@@ -12,20 +12,6 @@
</locale>
</schema>
<schema>
- <key>/schemas/apps/hamster-applet/general/timeout</key>
- <applyto>/apps/hamster-applet/general/timeout</applyto>
- <owner>hamster-applet</owner>
- <type>int</type>
- <default>30</default>
- <locale name="C">
- <short>Timeout in minutes</short>
- <long>
- After how many minutes hamster should stop tracking activity
- when computer is idle. Set to 0 to disable.
- </long>
- </locale>
- </schema>
- <schema>
<key>/schemas/apps/hamster-applet/general/enable_timeout</key>
<applyto>/apps/hamster-applet/general/enable_timeout</applyto>
<owner>hamster-applet</owner>
Modified: trunk/data/preferences.glade
==============================================================================
--- trunk/data/preferences.glade (original)
+++ trunk/data/preferences.glade Sat Aug 16 19:46:39 2008
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.5 on Fri May 23 01:06:41 2008 -->
+<!--Generated with glade3 3.4.5 on Fri Aug 15 18:29:43 2008 -->
<glade-interface>
<widget class="GtkWindow" id="preferences_window">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
@@ -38,52 +38,51 @@
<property name="column_spacing">4</property>
<property name="row_spacing">4</property>
<child>
- <widget class="GtkVBox" id="vbox3">
- <property name="width_request">150</property>
+ <widget class="GtkAlignment" id="alignment10">
<property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="spacing">4</property>
<child>
- <widget class="GtkLabel" id="categories_label">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">_Categories</property>
- <property name="use_underline">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- </packing>
+ <placeholder/>
</child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkAlignment" id="alignment7">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="xscale">0</property>
<child>
- <widget class="GtkScrolledWindow" id="scrolledwindow2">
+ <widget class="GtkButton" id="add_category">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_add_category_clicked"/>
<child>
- <widget class="GtkTreeView" id="category_list">
+ <widget class="GtkLabel" id="label4">
<property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="headers_visible">False</property>
- <property name="enable_search">False</property>
- <signal name="button_press_event" handler="on_category_list_button_pressed"/>
- <signal name="drag_motion" handler="on_category_list_drag_motion"/>
- <signal name="key_press_event" handler="on_category_list_key_pressed"/>
- <signal name="button_release_event" handler="on_category_list_button_released"/>
+ <property name="xpad">4</property>
+ <property name="ypad">2</property>
+ <property name="label" translatable="yes">N_ew Category</property>
+ <property name="use_underline">True</property>
</widget>
</child>
</widget>
- <packing>
- <property name="position">1</property>
- </packing>
</child>
</widget>
<packing>
- <property name="x_options"></property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
</packing>
</child>
<child>
@@ -270,51 +269,52 @@
</packing>
</child>
<child>
- <widget class="GtkAlignment" id="alignment7">
+ <widget class="GtkVBox" id="vbox3">
+ <property name="width_request">150</property>
<property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="xscale">0</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="spacing">4</property>
<child>
- <widget class="GtkButton" id="add_category">
+ <widget class="GtkLabel" id="categories_label">
+ <property name="visible">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Categories</property>
+ <property name="use_underline">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow2">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="response_id">0</property>
- <signal name="clicked" handler="on_add_category_clicked"/>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
<child>
- <widget class="GtkLabel" id="label4">
+ <widget class="GtkTreeView" id="category_list">
<property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="xpad">4</property>
- <property name="ypad">2</property>
- <property name="label" translatable="yes">N_ew Category</property>
- <property name="use_underline">True</property>
+ <property name="headers_visible">False</property>
+ <property name="enable_search">False</property>
+ <signal name="button_press_event" handler="on_category_list_button_pressed"/>
+ <signal name="drag_motion" handler="on_category_list_drag_motion"/>
+ <signal name="key_press_event" handler="on_category_list_key_pressed"/>
+ <signal name="button_release_event" handler="on_category_list_button_released"/>
</widget>
</child>
</widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
</child>
</widget>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <widget class="GtkAlignment" id="alignment10">
- <property name="visible">True</property>
- <child>
- <placeholder/>
- </child>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options">GTK_FILL</property>
+ <property name="x_options"></property>
</packing>
</child>
</widget>
@@ -360,56 +360,13 @@
</packing>
</child>
<child>
- <widget class="GtkVBox" id="vbox6">
+ <widget class="GtkCheckButton" id="idle_track">
<property name="visible">True</property>
- <child>
- <widget class="GtkCheckButton" id="idle_track">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Stop tracking when computer becomes idle</property>
- <property name="response_id">0</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="on_idle_track_toggled"/>
- </widget>
- </child>
- <child>
- <widget class="GtkAlignment" id="alignment1">
- <property name="visible">True</property>
- <property name="bottom_padding">8</property>
- <property name="left_padding">24</property>
- <child>
- <widget class="GtkHBox" id="slider_mins">
- <property name="visible">True</property>
- <property name="spacing">8</property>
- <child>
- <widget class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="yalign">0.94999998807907104</property>
- <property name="label" translatable="yes">Idle minutes:</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- </packing>
- </child>
- <child>
- <widget class="GtkHScale" id="idle_minutes">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="adjustment">30 5 95 5 10 5</property>
- <property name="digits">0</property>
- <signal name="value_changed" handler="on_idle_minutes_value_changed"/>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Stop tracking when computer becomes idle</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_idle_track_toggled"/>
</widget>
<packing>
<property name="position">1</property>
Modified: trunk/hamster/Configuration.py
==============================================================================
--- trunk/hamster/Configuration.py (original)
+++ trunk/hamster/Configuration.py Sat Aug 16 19:46:39 2008
@@ -31,7 +31,6 @@
# GConf key for global keybinding
GCONF_KEYBINDING = GCONF_DIR + "/keybinding"
- GCONF_TIMEOUT = GCONF_DIR + "/timeout"
GCONF_ENABLE_TIMEOUT = GCONF_DIR + "/enable_timeout"
GCONF_STOP_ON_SHUTDOWN = GCONF_DIR + "/stop_on_shutdown"
@@ -55,16 +54,12 @@
def __connect_notifications(self):
self._client.add_dir(self.GCONF_DIR, gconf.CLIENT_PRELOAD_RECURSIVE)
self._client.notify_add(self.GCONF_KEYBINDING, lambda x, y, z, a: dispatcher.dispatch("gconf_keybinding_changed", z.value.get_string()))
- self._client.notify_add(self.GCONF_TIMEOUT, lambda x, y, z, a: dispatcher.dispatch("gconf_timeout_changed", z.value.get_int()))
self._client.notify_add(self.GCONF_ENABLE_TIMEOUT, lambda x, y, z, a: dispatcher.dispatch("gconf_timeout_enabled_changed", z.value.get_bool()))
self._client.notify_add(self.GCONF_STOP_ON_SHUTDOWN, lambda x, y, z, a: dispatcher.dispatch("gconf_stop_on_shutdown_changed", z.value.get_bool()))
def get_keybinding(self):
return self._client.get_string(self.GCONF_KEYBINDING)
- def get_timeout(self):
- return self._client.get_int(self.GCONF_TIMEOUT)
-
def get_timeout_enabled(self):
return self._client.get_bool(self.GCONF_ENABLE_TIMEOUT)
@@ -75,9 +70,6 @@
def set_keybinding(self, binding):
self._client.set_string(self.GCONF_KEYBINDING, binding)
- def set_timeout(self, number):
- self._client.set_int(self.GCONF_TIMEOUT, int(number))
-
def set_timeout_enabled(self, enabled):
self._client.set_bool(self.GCONF_ENABLE_TIMEOUT, enabled)
Modified: trunk/hamster/applet.py
==============================================================================
--- trunk/hamster/applet.py (original)
+++ trunk/hamster/applet.py Sat Aug 16 19:46:39 2008
@@ -143,7 +143,6 @@
dispatcher.add_handler('gconf_timeout_enabled_changed', self.on_timeout_enabled_changed)
# init idle check
- self.timeout = self.config.get_timeout()
self.timeout_enabled = self.config.get_timeout_enabled()
def on_today_release_event(self, tree, event):
@@ -168,10 +167,13 @@
self.today = datetime.date.today()
# stop tracking task if computer is idle for X minutes
- if self.timeout_enabled and self.timeout and self.last_activity and \
- self.last_activity['end_time'] == None and \
- idle.getIdleSec() / 60.0 >= self.timeout:
- storage.touch_fact(self.last_activity)
+ if self.timeout_enabled and self.last_activity and \
+ self.last_activity['end_time'] == None:
+ idle_minutes = idle.getIdleSec() / 60.0
+ if idle_minutes > 0:
+ current_time = datetime.datetime.now()
+ idle_from = current_time - datetime.timedelta(minutes = idle_minutes)
+ storage.touch_fact(self.last_activity, end_time = idle_from)
if self.last_activity and self.last_activity['end_time'] == None:
Modified: trunk/hamster/idle.py
==============================================================================
--- trunk/hamster/idle.py (original)
+++ trunk/hamster/idle.py Sat Aug 16 19:46:39 2008
@@ -18,11 +18,21 @@
# along with Project Hamster. If not, see <http://www.gnu.org/licenses/>.
import dbus
+import gconf
+# TODO - since we don't allow to specify idle minutes, we should just listen
+# to the SessionIdleChanged signal from org.gnome.Screensaver
def getIdleSec():
bus = dbus.SessionBus()
- try:
- gs = bus.get_object('org.gnome.ScreenSaver', '/org/gnome/ScreenSaver')
- return int(gs.GetSessionIdleTime())
- except:
- return 0
+ gs = bus.get_object('org.gnome.ScreenSaver', '/org/gnome/ScreenSaver')
+ idle_time = gs.GetSessionIdleTime()
+
+ if idle_time > 0:
+ # if we are in idle - grab gconf setting how much is considered idle
+ client = gconf.client_get_default()
+ idle_delay = client.get_int("/apps/gnome-screensaver/idle_delay")
+ idle_time += idle_delay * 60 #delay is in minutes
+
+ return idle_time
+
+
\ No newline at end of file
Modified: trunk/hamster/preferences.py
==============================================================================
--- trunk/hamster/preferences.py (original)
+++ trunk/hamster/preferences.py Sat Aug 16 19:46:39 2008
@@ -169,11 +169,7 @@
def load_config(self):
self.get_widget("shutdown_track").set_active(self.config.get_stop_on_shutdown())
-
self.get_widget("idle_track").set_active(self.config.get_timeout_enabled())
- self.get_widget("slider_mins").set_sensitive(self.config.get_timeout_enabled())
- self.get_widget("idle_minutes").set_value(self.config.get_timeout())
-
self.get_widget("keybinding").set_text(self.config.get_keybinding())
@@ -523,10 +519,6 @@
def on_idle_track_toggled(self, checkbox):
self.config.set_timeout_enabled(checkbox.get_active())
- self.get_widget("slider_mins").set_sensitive(checkbox.get_active())
def on_keybinding_changed(self, textbox):
self.config.set_keybinding(textbox.get_text())
-
- def on_idle_minutes_value_changed(self, slider):
- self.config.set_timeout(slider.get_value())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]