root/branch/k0p/umitInterfaceEditor/Tools.py @ 1198

Revision 1198, 4.7 kB (checked in by kop-labs, 6 years ago)

Fixed bug - voidplace delete

Line 
1# Copyright (C) 2005 Insecure.Com LLC.
2#
3# Author: Luis A. Bastiao Silva <luis.kop@gmail.com>
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, write to the Free Software
17# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18import gtk
19from higwidgets.higboxes import HIGVBox
20from higwidgets.higbuttons import HIGMixButton, HIGButton
21from higwidgets.higscrollers import HIGScrolledWindow
22from higwidgets.higtables import HIGTable
23from higwidgets.higlabels import HIGEntryLabel
24from higwidgets.higentries import HIGTextEntry
25
26from umitCore.Logging import log
27from umitCore.I18N import _
28
29
30'''
31This is a tool of the left frame of UIE
32It do a part of the interface, and this tools is packed on the UIE Right frame
33
34'''
35
36
37TARGET_STRING = 0
38TARGET_ROOTWIN = 1
39
40
41target = [
42    ('STRING', 0, TARGET_STRING),
43    ('text/plain', 0, TARGET_STRING),
44    ('application/x-rootwin-drop', 0, TARGET_ROOTWIN)
45]
46
47
48
49class ToolDesign(HIGScrolledWindow):
50    def __init__(self, only_text=True):
51        HIGScrolledWindow.__init__(self)
52        self._box = HIGVBox()
53        vp = gtk.Viewport()
54
55        self._box.set_border_width(6)
56        if only_text:
57            self._draw_buttons()
58            self._pack()
59        #ELSE == Algo com icons; ETC!
60       
61        vp.add(self._box)
62        vp.set_shadow_type(gtk.SHADOW_NONE)
63        self.add(vp)
64    def _draw_buttons(self):
65        self.button_list = HIGButton('Option List')
66        img = gtk.Image()
67        img.set_from_file('share/icons/combo.png')
68        self.button_list.set_image(img) 
69        self.button_label = HIGButton('Label')
70        img = gtk.Image()
71        img.set_from_file('share/icons/label.png')
72        self.button_label.set_image(img)
73
74        self.button_label.drag_source_set(gtk.gdk.BUTTON1_MASK | gtk.gdk.BUTTON3_MASK,
75                          target, gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_MOVE)
76        self.button_label.connect('drag_data_get', self.source_drag_data_get)
77
78        self.button_check = HIGButton('Option Check')
79        img = gtk.Image()
80        img.set_from_file('share/icons/checkbutton.png')
81        self.button_check.set_image(img)
82        self.button_path = HIGButton('Choose Path')
83        self.button_text_entry = HIGButton('String')
84        img = gtk.Image()
85        img.set_from_file('share/icons/entry.png')
86        self.button_text_entry.set_image(img)
87        self.button_float = HIGButton('Float Spin')
88        img = gtk.Image()
89        img.set_from_file('share/icons/spinbutton.png')
90        self.button_float.set_image(img)       
91       
92        self.button_level = HIGButton('Level Spin')
93        img = gtk.Image()
94        img.set_from_file('share/icons/spinbutton.png')
95        self.button_level.set_image(img)       
96        self.button_interface = HIGButton('Interface')
97        self.button_integer = HIGButton('Integer Spin ')
98        img = gtk.Image()
99        img.set_from_file('share/icons/spinbutton.png')
100        self.button_integer.set_image(img)     
101    def source_drag_data_get(self, btn, context, selection_data, info, time):
102        selection_data.set(selection_data.target, 8, "I'm Data!")
103
104
105    def _pack(self):
106        box = self._box
107        box.pack_start(self.button_list, False, False)
108        box.pack_start(self.button_label, False, False)
109        box.pack_start(self.button_check, False, False)
110        box.pack_start(self.button_path, False, False)
111        box.pack_start(self.button_float, False, False)
112        box.pack_start(self.button_integer, False, False)
113        box.pack_start(self.button_level, False, False)
114       
115       
116
117class ToolBarInterface:
118    def __init__(self):
119        pass
120   
121
122class Proprieties(HIGScrolledWindow):
123    def __init__(self):
124        HIGScrolledWindow.__init__(self)
125        vp = gtk.Viewport()
126        self._create_widgets()
127        vp.add(self._box)
128        vp.set_shadow_type(gtk.SHADOW_NONE)
129        self.add(vp)
130
131    def _create_widgets(self):
132        '''
133        Create the main entrys of the option
134        '''
135        self._box = HIGVBox()
136       
137        self._table = HIGTable()
138       
139        self._label_name  = HIGEntryLabel(_('Name'))
140        self._entry_name = HIGTextEntry()
141       
142        self._table.attach(self._label_name, 0,1,0, 1)
143        self._table.attach(self._entry_name, 1,2,0,1)
144       
145        self._box.pack_start(self._table, False, False)
146       
147    def disable_all(self):
148        pass 
149    def load_data(self, option):
150        pass 
151    def unload(self,option):
152        pass 
153   
Note: See TracBrowser for help on using the browser.