1 |
# !Currency.py.Iconbar/py |
2 |
|
3 |
import wimp |
4 |
import ConvrtW |
5 |
import Update |
6 |
|
7 |
def init(): |
8 |
"Setup iconbar icon" |
9 |
global window_info, menu_iconbar |
10 |
wimp.iconbar_icon('!currency', click) |
11 |
window_info = wimp.info_window() |
12 |
menu_iconbar = wimp.menu('iconbar', ('task', ('info', window_info), 'update', 'quit')) |
13 |
|
14 |
def click(buttons, x): |
15 |
"Handle click on iconbar" |
16 |
if buttons == 1: |
17 |
Update.update() |
18 |
elif buttons == 2: |
19 |
reopen = 1 |
20 |
while reopen: |
21 |
selection, reopen = menu_iconbar.menu(x - 64, 96 + 44 * 3) |
22 |
if selection is None: |
23 |
pass |
24 |
elif selection[0] == 0: |
25 |
window_info.open_as_menu() |
26 |
reopen = 0 |
27 |
elif selection[0] == 1: |
28 |
Update.update() |
29 |
reopen = 0 |
30 |
elif selection[0] == 2: |
31 |
wimp.quit() |
32 |
elif buttons == 4: |
33 |
w = ConvrtW.convert_window() |
34 |
w.open_centred(-1) |
35 |
w.pane.put_caret(1) |