if getattr(dbus, 'version', (0,0,0)) >= (0,41,0):
import dbus.glib
-import board_window
-import thread_window
+import uri_opener
dbus_interface_name = "tk.tetteke.Hage1"
dbus.service.Object.__init__(self, bus_name, object_path)
@dbus.service.method(dbus_interface_name)
- def open_board(self, uri):
- board_window.open_board(uri)
-
- @dbus.service.method(dbus_interface_name)
- def open_thread(self, uri):
- thread_window.open_thread(uri)
+ def open_uri(self, uri):
+ uri_opener.open_uri(uri)
--- /dev/null
+# Copyright (C) 2006 by Aiwota Programmer
+# aiwotaprog@tetteke.tk
+#
+# This program 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.
+#
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+import board_window
+import thread_window
+from BbsType import bbs_type_judge_uri
+
+def open_uri(uri):
+ bbs_type = bbs_type_judge_uri.get_type(uri)
+ if bbs_type.is_board():
+ board_window.open_board(uri)
+ elif bbs_type.is_thread():
+ thread_window.open_thread(uri)
+ else:
+ print "the uri represents neither board nor thread: ", uri
from Hage1 import board_window
from Hage1 import config
from Hage1 import dbus_object
+from Hage1 import uri_opener
APPNAME = 'Hage1'
APPVERSION = '0.1'
from Hage1.BbsType import bbs_type_exception
for uri in uris:
try:
- bbs_type = bbs_type_judge_uri.get_type(uri)
- if bbs_type.is_board():
- board_window.open_board(uri)
- thread_window.open_thread(uri)
+ uri_opener.open_uri(uri)
except bbs_type_exception.BbsTypeError, msg:
print msg
gtk.main()
from Hage1.BbsType import bbs_type_exception
for uri in uris:
try:
- bbs_type = bbs_type_judge_uri.get_type(uri)
- if bbs_type.is_board():
- iface.open_board(uri)
- iface.open_thread(uri)
+ iface.open_uri(uri)
except bbs_type_exception.BbsTypeError, msg:
print msg