ontv r468 - trunk/ontv



Author: johans
Date: Thu Nov  6 21:29:25 2008
New Revision: 468
URL: http://svn.gnome.org/viewvc/ontv?rev=468&view=rev

Log:
Fixed some run time errors.

Added:
   trunk/ontv/key_binder.py
Removed:
   trunk/ontv/keybinder.py
Modified:
   trunk/ontv/Makefile.am
   trunk/ontv/applet.py
   trunk/ontv/assistant.py
   trunk/ontv/config.py
   trunk/ontv/dialogs.py

Modified: trunk/ontv/Makefile.am
==============================================================================
--- trunk/ontv/Makefile.am	(original)
+++ trunk/ontv/Makefile.am	Thu Nov  6 21:29:25 2008
@@ -10,7 +10,7 @@
 	dialogs.py		\
 	gui.py			\
 	__init__.py		\
-	keybinder.py		\
+	key_binder.py		\
 	listings.py		\
 	main.py			\
 	notify.py		\

Modified: trunk/ontv/applet.py
==============================================================================
--- trunk/ontv/applet.py	(original)
+++ trunk/ontv/applet.py	Thu Nov  6 21:29:25 2008
@@ -28,9 +28,9 @@
 from assistant import XMLTVAssistant
 from config import Configuration
 from dialogs import PreferencesDialog, SearchDialog, AboutDialog
-from keybinder import KeyBinder
-from window import ProgramWindow
+from key_binder import KeyBinder
 from reminders import Reminders
+from window import ProgramWindow
 from xmltv_file import XMLTVFile
 from ontv import NAME, VERSION, UI_DIR, LOCALE_DIR
 

Modified: trunk/ontv/assistant.py
==============================================================================
--- trunk/ontv/assistant.py	(original)
+++ trunk/ontv/assistant.py	Thu Nov  6 21:29:25 2008
@@ -36,7 +36,7 @@
         sys.exit(1)
 
 import gui
-import Utils
+import utils
 
 GRABBERS = {"Belgium": "tv_grab_be",
             "Brazil": "tv_grab_br",
@@ -130,7 +130,7 @@
         # Add grabbers which are in path
         for country in GRABBERS.keys():
             grabber = GRABBERS[country]
-            if Utils.is_in_path(grabber):
+            if utils.is_in_path(grabber):
                 self.country_combobox.append_text(country)
         installed_table.attach(self.country_combobox, 1, 2, 0, 1,
                                xoptions=gtk.EXPAND|gtk.FILL)
@@ -447,7 +447,7 @@
             self.expander.set_expanded(True)
             self.progressbar_changed = True
             self.set_page_type(page, gtk.ASSISTANT_PAGE_CONTENT)
-        elif Utils.is_in_path("tv_sort"):
+        elif utils.is_in_path("tv_sort"):
             arguments = self.grabber_command.split()
             sort_command = "tv_sort %s --output %s" % (self.xmltvfile_path,
                                                        self.xmltvfile_path)

Modified: trunk/ontv/config.py
==============================================================================
--- trunk/ontv/config.py	(original)
+++ trunk/ontv/config.py	Thu Nov  6 21:29:25 2008
@@ -24,7 +24,7 @@
 
 import gconf
 
-from gui import ErrorDialog
+import gui
 
 DIR_ONTV = "/apps/ontv"
 
@@ -69,7 +69,7 @@
             self.debug = args[0] or os.getenv("ONTV_DEBUG")
             self.__init_option_cache()
         else:
-            ed = ErrorDialog(_("Could not find configuration directory in GConf"), _("Please make sure that ontv.schemas was correctly installed."))
+            ed = gui.ErrorDialog(_("Could not find configuration directory in GConf"), _("Please make sure that ontv.schemas was correctly installed."))
             ed.run()
             sys.exit(1)
 

Modified: trunk/ontv/dialogs.py
==============================================================================
--- trunk/ontv/dialogs.py	(original)
+++ trunk/ontv/dialogs.py	Thu Nov  6 21:29:25 2008
@@ -31,9 +31,6 @@
 import config
 import gui
 import utils
-from ChannelDialog import ChannelDialog
-from gui import ProgramContextMenu
-from ProgramDialog import ProgramDialog
 from reminders import Reminder
 from assistant import GRABBERS, XMLTVAssistant
 from ontv import NAME, VERSION
@@ -838,9 +835,9 @@
             channels_iter = channels_model.iter_next(channels_iter)
 
     def create_search_treeview_menu(self, reminders_model):
-        self.search_treeview_menu = ProgramContextMenu(self.get_program,
-                                                       self.reminders,
-                                                       reminders_model)
+        self.search_treeview_menu = gui.ProgramContextMenu(self.get_program,
+                                                           self.reminders,
+                                                           reminders_model)
         self.search_treeview.connect("button-press-event",
                                      self.__search_treeview_button_press,
                                      self.search_treeview_menu)

Added: trunk/ontv/key_binder.py
==============================================================================
--- (empty file)
+++ trunk/ontv/key_binder.py	Thu Nov  6 21:29:25 2008
@@ -0,0 +1,78 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2004-2008 Johan Svedberg <johan svedberg com>
+
+# This file is part of OnTV.
+
+# OnTV is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# OnTV is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with OnTV; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+
+import sys
+
+import gobject
+
+import ontv.keybinder
+
+class KeyBinder(gobject.GObject):
+    __gproperties__ = {"show_window_hotkey": (str, "Show window hotkey",
+                       "The hotkey for showing the window", "",
+                       gobject.PARAM_READWRITE),
+                       "show_search_program_hotkey": (str, "Show search \
+                       program hotkey", "The hotkey for showing search \
+                       program", "", gobject.PARAM_READWRITE)}
+
+    __gsignals__ = {"activated": (gobject.SIGNAL_RUN_LAST, None,
+                                  (str, gobject.TYPE_ULONG))}
+
+    def __init__(self, config):
+        gobject.GObject.__init__(self)
+        self.config = config
+        self.props.show_window_hotkey = config.show_window_hotkey
+        self.props.show_search_program_hotkey = config.show_search_program_hotkey
+
+    def do_get_property(self, property):
+        if property.name == "show-window-hotkey":
+            return self.show_window_hotkey
+        elif property.name == "show-search-program-hotkey":
+            return self.show_search_program_hotkey
+
+    def do_set_property(self, property, value):
+        if property.name == "show-window-hotkey":
+            self.show_window_hotkey = value
+        elif property.name == "show-search-program-hotkey":
+            self.show_search_program_hotkey = value
+        self.bind(value, property.name)
+
+    def bind(self, key, name):
+        try:
+            ontv.keybinder.tomboy_keybinder_bind(key, self.__bind_activated,
+                                                 name)
+            if self.config.debug:
+                print "Binded key \"%s\" to %s." % (key, name)
+        except KeyError, ke:
+            print >> sys.stderr, ke
+
+    def __bind_activated(self, name):
+        self.emit("activated", name,
+                  ontv.keybinder.tomboy_keybinder_get_current_event_time())
+
+    def unbind(self, key):
+        try:
+            ontv.keybinder.tomboy_keybinder_unbind(key)
+            if self.config.debug:
+                print "Unbinded key \"%s\"." % (key)
+        except KeyError, ke:
+            print >> sys.stderr, ke
+
+# vim: set sw=4 et sts=4 tw=79 fo+=l:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]