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

Revision 1181, 4.0 kB (checked in by kop-labs, 6 years ago)

Fix Bugs - Undo/Redo System (Delete Events)

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_entry = HIGButton('Option List')
66        self.button_label = HIGButton('Label')
67        img = gtk.Image()
68        img.set_from_file('share/icons/label.png')
69        self.button_label.set_image(img)
70
71        self.button_label.drag_source_set(gtk.gdk.BUTTON1_MASK | gtk.gdk.BUTTON3_MASK,
72                          target, gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_MOVE)
73        self.button_label.connect('drag_data_get', self.source_drag_data_get)
74
75        self.button_spin = HIGButton('Option Check')
76        self.button_path = HIGButton('Choose Path')
77        self.button_text_entry = HIGButton('String')
78        self.button_float = HIGButton('Float Spin')
79       
80        self.button_level = HIGButton('Level Spin')
81        self.button_interface = HIGButton('Interface')
82        self.button_integer = HIGButton('Integer Spin ')
83       
84    def source_drag_data_get(self, btn, context, selection_data, info, time):
85        selection_data.set(selection_data.target, 8, "I'm Data!")
86
87
88    def _pack(self):
89        box = self._box
90        box.pack_start(self.button_entry, False, False)
91        box.pack_start(self.button_label, False, False)
92        box.pack_start(self.button_spin, False, False)
93        box.pack_start(self.button_path, False, False)
94        box.pack_start(self.button_float, False, False)
95        box.pack_start(self.button_integer, False, False)
96        box.pack_start(self.button_level, False, False)
97       
98       
99
100class ToolBarInterface:
101    def __init__(self):
102        pass
103   
104
105class Proprieties(HIGScrolledWindow):
106    def __init__(self):
107        HIGScrolledWindow.__init__(self)
108        vp = gtk.Viewport()
109        self._create_widgets()
110        vp.add(self._box)
111        vp.set_shadow_type(gtk.SHADOW_NONE)
112        self.add(vp)
113
114    def _create_widgets(self):
115        '''
116        Create the main entrys of the option
117        '''
118        self._box = HIGVBox()
119       
120        self._table = HIGTable()
121       
122        self._label_name  = HIGEntryLabel(_('Name'))
123        self._entry_name = HIGTextEntry()
124       
125        self._table.attach(self._label_name, 0,1,0, 1)
126        self._table.attach(self._entry_name, 1,2,0,1)
127       
128        self._box.pack_start(self._table, False, False)
129       
130    def disable_all(self):
131        pass 
132    def load_data(self, option):
133        pass 
134    def unload(self,option):
135        pass 
136   
Note: See TracBrowser for help on using the browser.