8 from choices
import settings
15 class SetOfBarsBase(object):
16 def __init__(self
, orient
= barwidget
.VERT
, length
= -1):
18 self
.layout(orient
, length
)
19 self
.connect("button-release-event", self
.click_release_cb
)
21 def layout(self
, orient
, length
= -1):
26 if orient
== barwidget
.VERT
:
27 self
.box
= g
.HBox(True, SPACING
)
29 self
.box
= g
.VBox(True, SPACING
)
31 for n
in range(settings
.get_num_bars()):
36 def repack(self
, orient
= None, length
= None):
42 self
.layout(orient
, length
)
44 def update_label_font(self
, font_name
= None):
46 font_name
= settings
.get_label_font()
47 pfd
= pango
.FontDescription(font_name
)
51 def update_overlap(self
, overlap
):
53 b
.update_overlap(overlap
)
55 def add_bar(self
, num
):
56 desc
= plugins
.all_descs
[num
]
57 pfd
= pango
.FontDescription(settings
.get_label_font())
58 b
= barwidget
.BarWidget(desc
, self
.orient
, desc
.label
,
59 settings
.get_overlap(), pfd
, self
.length
)
61 self
.box
.pack_start(b
, True, True, PADDING
)
64 def click_release_cb(self
, widget
, event
):
65 if (event
.button
== 1):
66 choicesui
.run_dialog(self
)
70 def run_choices_dialog(self
, *args
):
71 choicesui
.run_dialog(self
)
73 def get_bar_widget(self
, num
):
77 class SetOfBars(g
.EventBox
, SetOfBarsBase
):
78 def __init__(self
, orient
= barwidget
.VERT
, length
= -1,
79 menu_pos_func
= None):
80 g
.EventBox
.__init
__(self
)
81 SetOfBarsBase
.__init
__(self
, orient
, length
)
82 self
.connect("button-press-event", self
.menu_button_cb
)
84 def menu_button_cb(self
, widget
, event
):
85 if (event
.button
== 3):
87 i
= g
.ImageMenuItem(g
.STOCK_ABOUT
)
88 i
.connect("activate", show_about
)
90 i
= g
.ImageMenuItem(g
.STOCK_PREFERENCES
)
91 i
.connect("activate", self
.run_choices_dialog
)
93 i
= g
.ImageMenuItem(g
.STOCK_QUIT
)
94 i
.connect("activate", compat
.quit
)
97 menu
.popup(None, None, self
.menu_pos_func
, event
.button
, event
.time
)
107 def show_about(*args
):
108 global logo
, authors
, version
109 if not authors
and not version
:
110 authors
, version
= compat
.get_app_info()
112 authors
= "Tony Houghton"
114 logo
= compat
.get_logo(64)
116 d
.set_name("SysBars")
118 d
.set_version(version
)
119 d
.set_copyright("\302\251 Tony Houghton")
120 d
.set_website('http://www.realh.co.uk')
121 d
.set_authors([authors
])