2008年3月7日 星期五

在 openSUSE 10.3 安裝 kiba-dock


遵循 http://www.kiba-dock.org/components/com_mambowiki/index.php?title=Installing_Kiba-Dock
從 svn 安裝 kiba-dock (因為 X11:/XGL 似乎已不維護 kiba-dock 了,故無法從這個套件庫安裝)
要使用 svn 您需要先安裝 subversion
當然您還需要編譯的基本基本套件 gcc 和 make
通常從 svn 編譯還需要 automake autoconf libtool intltool gettext-devel
編譯 akamaru 需要 glib2-devel (在最近的版本 akamaru 無法使用,所以維護者暫時不加入 akamaru 支援)
編譯 kiba-dock 需要 gtk2-devel cairo-devel pango-devel libxml2-devel dbus-1-glib-devel
如果要繼續編譯 kiba-plugins 則還要加 librsvg-devel,若要加上 akamaru 支援,akamaru 也要裝上
編譯 kiba-plugins 需要 python-gtk-devel libgnomeui-devel gnome-menus-devel gnome-vfs2-devel libgtop-devel kiba-dock dbus-1-devel librsvg-devel
編譯 kiba-dbus-plugins 需要 gtk2-devel dbus-1-devel python-gtk-devel kiba-dock
編譯 kiba-gaim-plugin 需要 glib2-devel dbus-1-devel librsvg-devel kiba-dock pidgin-devel
編譯 kiba-ephy-extension 則未成功過,可能需要再加上 epiphany-devel gnome-common?
(在此就不安裝了,因為要求 Epiphany = 2.18,但 openSUSE 10.3 提供的是 2.20,openSUSE 10.2 則是 2.16)
現在要用套件庫一次裝起來
使用 smart :
# smart install subversion gcc make automake autoconf libtool intltool gettext-devel glib2-devel gtk2-devel cairo-devel pango-devel libxml2-devel dbus-1-glib-devel librsvg-devel python-gtk-devel libgnomeui-devel gnome-menus-devel gnome-vfs2-devel libgtop-devel dbus-1-devel pidgin-devel

使用 zypper :
# zypper in subversion gcc make automake autoconf libtool intltool gettext-devel glib2-devel gtk2-devel cairo-devel pango-devel libxml2-devel dbus-1-glib-devel librsvg-devel python-gtk-devel libgnomeui-devel gnome-menus-devel gnome-vfs2-devel libgtop-devel dbus-1-devel pidgin-devel

安裝完成後就開始進行編譯與安裝 kiba-dock 的工作
$ svn co https://kibadock.svn.sourceforge.net/svnroot/kibadock/trunk/ kiba

此時會建立一個 kiba 的目錄,裏面有 akamaru, kiba-dock, kiba-plugins, kiba-dbus-plugins, kiba-gaim-plugin, kiba-ephy-extension 等子目錄
請依照 akamaru(如果需要) -> kiba-dock -> 其他目錄來操作
$ cd kiba/kiba-dock/
$ ./autogen.sh
$ make
$ su
# make install
# exit
$ cd ../kiba-plugins
$ ./autogen.sh
$ make
$ su
# make install

應該可以很順利安裝 kiba-dock 和 kiba-plugins
接著您可以先在終端機執行 kiba-dock
在按右鍵進行設定
看看是否有任何錯誤訊息

新增一個 firefox 啟動器時
會將啟動命令設為 firefox 0
請自行將 0 去除

啟用 sysinfo 時出現
** (kiba-dock:15281): WARNING **: Error (sysinfo.c @ line 441):
KibaSysinfo: failed to load theme

For a core dump, run kiba-dock with --g-fatal-warnings.

您可以在 Sysinfo 設定視窗中選擇 theme,就會出現刻度表了

啟用 Tray 時出現
** (kiba-dock:15281): WARNING **: Error (plugin.c @ line 239):
'/usr/lib/kiba-dock/libtray.so' is not loadable

For a core dump, run kiba-dock with --g-fatal-warnings.

表示您可能有其他的系統匣正在運作
請關閉其他的系統匣即可


若沒有問題,您可以關閉該終端機(您作的變更設定已經儲存)
然後依您需求照上面方法裝上 kiba-dbus-plugins 和 kiba-gaim-plugin
再重新測試一次
Traceback (most recent call last):
File "/usr/share/kiba-dock/dbus_scripts/kiba-feeder.py", line 6, in
import feedparser
ImportError: No module named feedparser
Traceback (most recent call last):
File "/usr/share/kiba-dock/dbus_scripts/kiba-signal.py", line 11, in
import dbus
ImportError: No module named dbus
Traceback (most recent call last):
File "/usr/share/kiba-dock/dbus_scripts/kiba-battery.py", line 11, in
import dbus
ImportError: No module named dbus
Traceback (most recent call last):
File "/usr/share/kiba-dock/dbus_scripts/kiba-mail.py", line 11, in
import dbus
ImportError: No module named dbus
Traceback (most recent call last):
File "/usr/share/kiba-dock/dbus_scripts/kiba-weather.py", line 12, in
import dbus
ImportError: No module named dbus

表示 feedparser 和 dbus 模組沒有安裝
請安裝 python-feedparser 和 dbus-1-python
然後在設定中啟動 dbus 中您要的設定
Traceback (most recent call last):
File "/usr/share/kiba-dock/dbus_scripts/kiba-mail.py", line 178, in
kiba_mail=KibaMailPlugin()
File "/usr/share/kiba-dock/dbus_scripts/kiba-mail.py", line 83, in __init__
self.check_mails()
File "/usr/share/kiba-dock/dbus_scripts/kiba-mail.py", line 94, in check_mails
self.Server = POP3(SERVER_NAME)
File "/usr/lib/python2.5/poplib.py", line 84, in __init__
for res in socket.getaddrinfo(self.host, self.port, 0, socket.SOCK_STREAM):
socket.gaierror: (-2, 'Name or service not known')

表示您未設定您的信箱
但您會發現即使設定信箱,也會有相同的訊息
請檢查 /usr/share/kiba-dock/dbus_scripts/kiba-mail.py 的內容
將所有的 gset-kiba 替換成 kiba-settings
若出現無法儲存設定的情況,請直接編輯修改
~.kiba-dock/config.xml
下面是我修改完後的樣子(使用 gmail,請先到 gmail 帳戶啟用 pop3 功能)

我設定使用 kmail 來開啟郵件
若您要使用瀏覽器介面,直接設定成
firefox http://mail.google.com/mail

mail 的圖示按下去後沒有反應(並未依照您設定的 mail-client 開啟信箱)
請修改 /usr/share/kiba-dock/dbus_scripts/kiba-mail.py
def button_release_handler(self, id):
if id != PLUGIN_NAME:
return
self.kiba.LaunchCommand('%s' % (LAUNCHER))
其他修正包含了 mail 的提示列越來越長
還有可能是 BLINK == 'yes' 時引起的崩潰
請參考 kiba-mail.py.diff
--- kiba-mail.py-orig    2008-03-05 19:54:10.000000000 +0800
+++ kiba-mail.py 2008-03-06 23:44:18.000000000 +0800
@@ -18,28 +18,30 @@
CHECK_INTERVALL = 300000

# Should the icon blink on and off? And for how long? (Seconds)
-BLINK = 'yes'
+BLINK = 'no'
BLINK_DURATION = 30

## MAIL SERVER
-VISUAL_NAME = 'Mail Account'
+VISUAL_NAME = getoutput("kiba-settings --get-char mail_server_name")
+if VISUAL_NAME == "Unable to find Option 'mail_server_name' in the Settings File":
+ VISUAL_NAME = 'Mail Account'

if getoutput("kiba-settings --get-bool mail_enable") != "TRUE":
exit()

-LAUNCHER = getoutput("gset-kiba --get-char mail_client")
+LAUNCHER = getoutput("kiba-settings --get-char mail_client")
if LAUNCHER == "Unable to find Option 'mail_client' in the Settings File":
LAUNCHER = 'mozilla-thunderbird'
-SERVER_NAME = getoutput("gset-kiba --get-char mail_server_name")
+SERVER_NAME = getoutput("kiba-settings --get-char mail_server_name")
if SERVER_NAME == "Unable to find Option 'mail_server_name' in the Settings File":
SERVER_NAME = ''
-SERVER_TYPE = getoutput("gset-kiba --get-char mail_server_type")
+SERVER_TYPE = getoutput("kiba-settings --get-char mail_server_type")
if SERVER_TYPE == "Unable to find Option 'mail_server_type' in the Settings File":
SERVER_TYPE = ''
-USER_NAME = getoutput("gset-kiba --get-char mail_username")
+USER_NAME = getoutput("kiba-settings --get-char mail_username")
if USER_NAME == "Unable to find Option 'mail_username' in the Settings File":
USER_NAME = ''
-PASSWORD = getoutput("gset-kiba --get-char mail_password")
+PASSWORD = getoutput("kiba-settings --get-char mail_password")
if PASSWORD == "Unable to find Option 'mail_password' in the Settings File":
PASSWORD = ''

@@ -101,7 +103,7 @@
self.Messages = self.Server.list()[1]
self.Counter = (self.Counter + len(self.Messages))
if len(self.Messages) > 0:
- self.Detailed = self.Detailed + ', ' + VISUAL_NAME + ': ' + str(len(self.Messages)) + ' New'
+ self.Detailed = ', ' + VISUAL_NAME + ': ' + str(len(self.Messages)) + ' New'

#IMAP
#imap = imaplib.IMAP4(SERVER_NAME)
@@ -148,10 +150,11 @@
def context_menu_handler(self, id):
if id != PLUGIN_NAME:
return
-
+
def button_release_handler(self, id):
if id != PLUGIN_NAME:
return
+ self.kiba.LaunchCommand('%s' % (LAUNCHER))

def close_handler(self, sender=None):
self.icon_added=0
@@ -165,7 +168,7 @@

self.check_mails()
self.set_icon_and_titel()
- if self.Counter > 0 and Blink == 'yes':
+ if self.Counter > 0 and BLINK == 'yes':
gobject.timeout_add(1000, self.blink_icon)

return 1


要設定 feeder 要自行修改 /usr/share/kiba-dock/dbus_scripts/kiba-feeder.py 的內容
依照格式將 feed 放在 FEED_URLS 裏面
例如:
FEED_URLS = ( \
'http://www.neowin.net/fb.php?page=gamers', \
'http://www.neowin.net/fb.php?page=main', \
'http://www.neowin.net/fb.php?page=software', \
'http://swyear.blogspot.com/feeds/posts/default', \
'http://planet.linux.org.tw/atom.xml', \
'http://hyperrate.com/rss.php?eid=1', \
'')

這時可能會出現問題
Traceback (most recent call last):
File "/usr/share/kiba-dock/dbus_scripts/kiba-feeder.py", line 166, in
kiba_feeder=KibaFeeder()
File "/usr/share/kiba-dock/dbus_scripts/kiba-feeder.py", line 72, in __init__
self.check_feeds()
File "/usr/share/kiba-dock/dbus_scripts/kiba-feeder.py", line 93, in check_feeds
Year = str(LatestItemDate.split(' ')[3])
IndexError: list index out of range

這是因為 rss feed 日期格式不同所造成的
可能的格式(說不定有更多):
Wed, 05 Mar 2008 10:52:46 +0000
2008-03-06T01:16:54+00:00
2008-02-26T20:04:08.578+08:00
修改起來有點小複雜
您可以試著套用下面的差別檔
kiba-feeder.py.diff
--- kiba-feeder.py-orig    2008-03-05 20:38:37.000000000 +0800
+++ kiba-feeder.py 2008-03-06 21:24:30.000000000 +0800
@@ -31,6 +31,9 @@
'http://www.neowin.net/fb.php?page=gamers', \
'http://www.neowin.net/fb.php?page=main', \
'http://www.neowin.net/fb.php?page=software', \
+ 'http://swyear.blogspot.com/feeds/posts/default', \
+ 'http://planet.linux.org.tw/atom.xml', \
+ 'http://hyperrate.com/rss.php?eid=1', \
'')

#Set this if you want to use a custom Theme THEME_DIRECTORY
@@ -80,6 +83,34 @@
if FeedNumber == (len(FEED_URLS)-1):
break

+ def month_number(month):
+ if month == 'Jan':
+ return '01'
+ elif month == 'Feb':
+ return '02'
+ elif month == 'Mar':
+ return '03'
+ elif month == 'Apr':
+ return '04'
+ elif month == 'May':
+ return '05'
+ elif month == 'Jun':
+ return '06'
+ elif month == 'Jul':
+ return '07'
+ elif month == 'Aug':
+ return '08'
+ elif month == 'Sep':
+ return '09'
+ elif month == 'Oct':
+ return '10'
+ elif month == 'Nov':
+ return '11'
+ elif month == 'Dec':
+ return '12'
+ else:
+ print "error month name"
+
Feed = feedparser.parse(FEED_URLS[FeedNumber])

FeedTitle = Feed['channel']['title']
@@ -87,16 +118,24 @@
LatestItemURL = Feed['items'][0]['link']
LatestItemDate = Feed['items'][0]['date']

- Year = str(LatestItemDate.split(' ')[3])
- Month = str(12)
- Day = str(LatestItemDate.split(' ')[1])
- Time = str(LatestItemDate.split(' ')[4])
- Hour = str(Time.split(':')[0])
- Minute = str(Time.split(':')[1])
- Second = str(Time.split(':')[2])
+ if LatestItemDate[1] in '1234567890':
+ Year = str(LatestItemDate.split('-')[0])
+ Month = str(LatestItemDate.split('-')[1])
+ DayPartOne = str(LatestItemDate.split('-')[2])
+ Day = str(DayPartOne.split('T')[0])
+ Time = str(LatestItemDate.split('T')[1])
+ Hour = str(Time.split(':')[0])
+ Minute = str(Time.split(':')[1])
+ else:
+ Year = str(LatestItemDate.split(' ')[3])
+ Month = month_number(str(LatestItemDate.split(' ')[2]))
+ Day = str(LatestItemDate.split(' ')[1])
+ Time = str(LatestItemDate.split(' ')[4])
+ Hour = str(Time.split(':')[0])
+ Minute = str(Time.split(':')[1])

- if int(Year + Month + Day + Hour + Minute + Second) > self.TimeCalc:
- self.TimeCalc = int(Year + Month + Day + Hour + Minute + Second)
+ if int(Year + Month + Day + Hour + Minute) > self.TimeCalc:
+ self.TimeCalc = int(Year + Month + Day + Hour + Minute)

self.description = ('%s : %s' % (FeedTitle,LatestItemTitle))
self.URL = LatestItemURL
如果得到下面的錯誤
Traceback (most recent call last):
File "/usr/share/kiba-dock/dbus_scripts/kiba-feeder.py", line 187, in
kiba_feeder=KibaFeeder()
File "/usr/share/kiba-dock/dbus_scripts/kiba-feeder.py", line 81, in __init__
self.check_feeds()
File "/usr/share/kiba-dock/dbus_scripts/kiba-feeder.py", line 130, in check_feeds
self.status = open(STATUS_DIR + '/Status.txt','r')
IOError: [Errno 2] No such file or directory: '/tmp/Status.txt'

請執行
touch /tmp/Status.txt


但有時仍會有嚴重的程式崩潰
Traceback (most recent call last):
File "/usr/share/kiba-dock/dbus_scripts/kiba-feeder.py", line 193, in timeout_func
self.set_icon_and_titel()
File "/usr/share/kiba-dock/dbus_scripts/kiba-feeder.py", line 159, in set_icon_and_titel
self.kiba.SetIcon(PLUGIN_NAME, self.icon)
File "/usr/lib/python2.5/site-packages/dbus/proxies.py", line 135, in __call__
**keywords)
File "/usr/lib/python2.5/site-packages/dbus/connection.py", line 603, in call_blocking
message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name :1.21 was not provided by any .service files

不知道和什麼有關...

如果您想用套件庫安裝 kiba-dock
您可以加入 http://download.opensuse.org/repositories/home:/swyear/openSUSE_10.3/ 套件庫


沒有留言: