File tree 2 files changed +19
-4
lines changed 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change 3
3
# System tray notifier for sboui updates. Source code adapted from
4
4
# salix-update-notifier by George Vlahavas (gapan).
5
5
6
- import gtk
7
6
import sys
7
+ if sys .version_info [0 ] < 3 :
8
+ import gtk
9
+ else :
10
+ import gi
11
+ # Note: see deprecation note near the bottom.
12
+ gi .require_version ('Gtk' , '3.0' )
13
+ from gi .repository import Gtk as gtk
8
14
9
15
def accept (data = None ):
10
16
sys .exit (0 )
@@ -51,7 +57,12 @@ def on_left_click(event):
51
57
accept ()
52
58
53
59
if __name__ == '__main__' :
54
- icon = gtk .status_icon_new_from_icon_name ("sboui" )
60
+ if sys .version_info [0 ] < 3 :
61
+ icon = gtk .status_icon_new_from_icon_name ("sboui" )
62
+ else :
63
+ # Note: this is deprecated in Gtk+3 and removed in Gtk+4. Will
64
+ # eventually need to find a replacement.
65
+ icon = gtk .StatusIcon ().new_from_icon_name ("sboui" )
55
66
icon .set_tooltip_text ('SBo updates are available' )
56
67
icon .connect ('popup-menu' , on_right_click )
57
68
icon .connect ('activate' , on_left_click )
Original file line number Diff line number Diff line change @@ -13,8 +13,12 @@ def sbo_updates_available():
13
13
stdout = subprocess .PIPE )
14
14
retval = False
15
15
for line in iter (proc .stdout .readline ,'' ):
16
- if line .find ("upgradable SlackBuild" ) != - 1 :
17
- if line .startswith ("No" ):
16
+ if sys .version_info [0 ] < 3 :
17
+ dcdline = line
18
+ else :
19
+ dcdline = line .decode ()
20
+ if dcdline .find ("upgradable SlackBuild" ) != - 1 :
21
+ if dcdline .startswith ("No" ):
18
22
break
19
23
else :
20
24
retval = True
You can’t perform that action at this time.
0 commit comments