~taiebot65/cairo-dock-plug-ins-extras/Subdock-2

« back to all changes in this revision

Viewing changes to demos/demo_python/demo_python

  • Committer: matttbe
  • Date: 2010-04-26 15:03:51 UTC
  • Revision ID: matttbe@gmail.com-20100426150351-blsyzvb3akf3ngdm
Added demo_mono

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
# This is a part of the external demo applet for Cairo-Dock
4
4
#
5
5
# Copyright : (C) 2010 by Fabounet
6
 
# E-mail : fabounet@users.berlios.de
 
6
# E-mail : fabounet@glx-dock.org
7
7
#
8
8
#
9
9
# This program is free software; you can redistribute it and/or
53
53
 
54
54
def action_on_middle_click():
55
55
        print ">>> middle clic !"
56
 
        myIcon.AskValue("Set the value you want", myApplet.count, myApplet.config['iMaxValue']);
 
56
        myApplet.icon.AskValue("Set the value you want", myApplet.count, myApplet.config['iMaxValue']);
57
57
 
58
58
def action_on_build_menu():
59
59
        print ">>> build menu !"
60
 
        myIcon.PopulateMenu(["set min value", "set medium value", "set max value"])
 
60
        myApplet.icon.PopulateMenu(["set min value", "set medium value", "set max value"])
61
61
        
62
62
def action_on_menu_select(iNumEntry):
63
63
        print ">>> choice",iNumEntry,"has been selected !"
112
112
### Applet class ###
113
113
####################
114
114
class Applet:
115
 
        def __init__(self,icon,sub_icons):
 
115
        def __init__(self):
116
116
                self.icon = None
117
117
                self.sub_icons = None
118
118
                self.config = {}
127
127
                self.config['yesno']            = keyfile.getboolean('Configuration', 'yesno')
128
128
        
129
129
        def begin(self):
 
130
                self.connect_to_dock()
130
131
                self.icon.ShowDialog("I'm connected to Cairo-Dock !", 4)  # show a dialog with this message for 4 seconds.
131
132
                self.icon.SetQuickInfo(format(self.count, "d"))  # write the counter value on the icon.
132
133
                self.icon.AddDataRenderer("gauge", 1, self.config['cTheme'])  # set a gauge with the theme read in config to display the value of the counter.
133
134
                self.icon.RenderValues([float(self.count)/self.config['iMaxValue']])  # draw the gauge with an initial value.
134
 
                mySubIcons.AddSubIcons(["icon 1", "firefox-3.0", "id1", "icon 2", "trash", "id2", "icon 3", "thunderbird", "id3", "icon 4", "nautilus", "id4"])  # add 4 icons in our sub-dock. The tab contains triplets of {label, image, ID}.
 
135
                self.sub_icons.AddSubIcons(["icon 1", "firefox-3.0", "id1", "icon 2", "trash", "id2", "icon 3", "thunderbird", "id3", "icon 4", "nautilus", "id4"])  # add 4 icons in our sub-dock. The tab contains triplets of {label, image, ID}.
135
136
                self.sub_icons.RemoveSubIcon("id2")  # remove the 2nd icon of our sub-dock.
136
137
                self.sub_icons.SetQuickInfo("1", "id1")  # write the ID on each icon of the sub-dock.
137
138
                self.sub_icons.SetQuickInfo("3", "id3")
156
157
                self.icon.connect_to_signal("on_menu_select", action_on_menu_select)  # when the user selects an entry of this menu.
157
158
                self.icon.connect_to_signal("on_scroll", action_on_scroll)  # when the user scroll up or down on our icon.
158
159
                self.icon.connect_to_signal("on_drop_data", action_on_drop_data)  # when the user drops something on our icon.
159
 
                #myIcon.connect_to_signal("on_init_module", action_on_init)
 
160
                #myApplet.icon.connect_to_signal("on_init_module", action_on_init)
160
161
                self.icon.connect_to_signal("on_answer", action_on_answer)  # when the user answer a question.
161
162
                self.icon.connect_to_signal("on_stop_module", action_on_stop)  # when the user deactivate our applet (or the DBus plug-in, or when the Cairo-Dock is stopped).
162
163
                self.icon.connect_to_signal("on_reload_module", action_on_reload)  # when the user changes something in our config, or when the desklet is resized (with no change in the config).