Changeset 3786
- Timestamp:
- 10/28/11 17:02:19 (19 months ago)
- Location:
- trunk
- Files:
-
- 27 edited
-
demos/pychan_demo/colortester.py (modified) (6 diffs)
-
demos/pychan_demo/poc_gui_animation.py (modified) (3 diffs)
-
demos/pychan_demo/sliders.py (modified) (2 diffs)
-
engine/python/fife/extensions/pychan/__init__.py (modified) (1 diff)
-
engine/python/fife/extensions/pychan/attrs.py (modified) (1 diff)
-
engine/python/fife/extensions/pychan/internal.py (modified) (1 diff)
-
engine/python/fife/extensions/pychan/properties.py (modified) (1 diff)
-
engine/python/fife/extensions/pychan/widgets/__init__.py (modified) (1 diff)
-
engine/python/fife/extensions/pychan/widgets/basictextwidget.py (modified) (3 diffs)
-
engine/python/fife/extensions/pychan/widgets/buttons.py (modified) (8 diffs)
-
engine/python/fife/extensions/pychan/widgets/checkbox.py (modified) (4 diffs)
-
engine/python/fife/extensions/pychan/widgets/common.py (modified) (1 diff)
-
engine/python/fife/extensions/pychan/widgets/containers.py (modified) (12 diffs)
-
engine/python/fife/extensions/pychan/widgets/dropdown.py (modified) (3 diffs)
-
engine/python/fife/extensions/pychan/widgets/icon.py (modified) (3 diffs)
-
engine/python/fife/extensions/pychan/widgets/label.py (modified) (3 diffs)
-
engine/python/fife/extensions/pychan/widgets/layout.py (modified) (1 diff)
-
engine/python/fife/extensions/pychan/widgets/listbox.py (modified) (3 diffs)
-
engine/python/fife/extensions/pychan/widgets/percentagebar.py (modified) (2 diffs)
-
engine/python/fife/extensions/pychan/widgets/radiobutton.py (modified) (3 diffs)
-
engine/python/fife/extensions/pychan/widgets/scrollarea.py (modified) (3 diffs)
-
engine/python/fife/extensions/pychan/widgets/slider.py (modified) (6 diffs)
-
engine/python/fife/extensions/pychan/widgets/textbox.py (modified) (2 diffs)
-
engine/python/fife/extensions/pychan/widgets/textfield.py (modified) (2 diffs)
-
engine/python/fife/extensions/pychan/widgets/widget.py (modified) (5 diffs)
-
tests/fife_test/tests/PychanTest.py (modified) (10 diffs)
-
tools/editor/plugins/ObjectSelector.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/demos/pychan_demo/colortester.py
r3587 r3786 2 2 3 3 # #################################################################### 4 # Copyright (C) 2005-201 0by the FIFE team5 # http://www.fifengine. de4 # Copyright (C) 2005-2011 by the FIFE team 5 # http://www.fifengine.net 6 6 # This file is part of FIFE. 7 7 # … … 63 63 }) 64 64 # alpha value needs to be set, otherwise you don't see colors ;-) 65 self.widget.findChild(name="base_aslider"). setValue(float(255))66 self.widget.findChild(name="background_aslider"). setValue(float(255))67 self.widget.findChild(name="foreground_aslider"). setValue(float(255))68 self.widget.findChild(name="selection_aslider"). setValue(float(255))65 self.widget.findChild(name="base_aslider").value = float(255) 66 self.widget.findChild(name="background_aslider").value = float(255) 67 self.widget.findChild(name="foreground_aslider").value = float(255) 68 self.widget.findChild(name="selection_aslider").value = float(255) 69 69 70 70 # init stuff … … 79 79 Update rgba base colors of all examples and show the values 80 80 """ 81 r = int(self.widget.findChild(name="base_rslider"). getValue())82 g = int(self.widget.findChild(name="base_gslider"). getValue())83 b = int(self.widget.findChild(name="base_bslider"). getValue())84 a = int(self.widget.findChild(name="base_aslider"). getValue())81 r = int(self.widget.findChild(name="base_rslider").value) 82 g = int(self.widget.findChild(name="base_gslider").value) 83 b = int(self.widget.findChild(name="base_bslider").value) 84 a = int(self.widget.findChild(name="base_aslider").value) 85 85 86 86 # update slider labels … … 106 106 Update rgba background colors of all examples and show the values 107 107 """ 108 r = int(self.widget.findChild(name="background_rslider"). getValue())109 g = int(self.widget.findChild(name="background_gslider"). getValue())110 b = int(self.widget.findChild(name="background_bslider"). getValue())111 a = int(self.widget.findChild(name="background_aslider"). getValue())108 r = int(self.widget.findChild(name="background_rslider").value) 109 g = int(self.widget.findChild(name="background_gslider").value) 110 b = int(self.widget.findChild(name="background_bslider").value) 111 a = int(self.widget.findChild(name="background_aslider").value) 112 112 113 113 # update slider labels … … 133 133 Update rgba selection colors of all examples and show the values 134 134 """ 135 r = int(self.widget.findChild(name="selection_rslider"). getValue())136 g = int(self.widget.findChild(name="selection_gslider"). getValue())137 b = int(self.widget.findChild(name="selection_bslider"). getValue())138 a = int(self.widget.findChild(name="selection_aslider"). getValue())135 r = int(self.widget.findChild(name="selection_rslider").value) 136 g = int(self.widget.findChild(name="selection_gslider").value) 137 b = int(self.widget.findChild(name="selection_bslider").value) 138 a = int(self.widget.findChild(name="selection_aslider").value) 139 139 140 140 # update slider labels … … 160 160 Update rgba foreground colors of all examples and show the values 161 161 """ 162 r = int(self.widget.findChild(name="foreground_rslider"). getValue())163 g = int(self.widget.findChild(name="foreground_gslider"). getValue())164 b = int(self.widget.findChild(name="foreground_bslider"). getValue())165 a = int(self.widget.findChild(name="foreground_aslider"). getValue())162 r = int(self.widget.findChild(name="foreground_rslider").value) 163 g = int(self.widget.findChild(name="foreground_gslider").value) 164 b = int(self.widget.findChild(name="foreground_bslider").value) 165 a = int(self.widget.findChild(name="foreground_aslider").value) 166 166 167 167 # update slider labels -
trunk/demos/pychan_demo/poc_gui_animation.py
r3543 r3786 77 77 78 78 self.delay_slider = self.widget.findChild(name="delay") 79 self.delay_slider. setValue(float(DEFAULT_DELAY))79 self.delay_slider.value = float(DEFAULT_DELAY) 80 80 81 81 self.delay_display = self.widget.findChild(name="delay_label") … … 97 97 def _set_delay_display(self): 98 98 """ set delay display according to slider value """ 99 value = self.delay_slider. getValue()99 value = self.delay_slider.value 100 100 self.delay_display.text = unicode(str(int(value))) 101 101 … … 109 109 self._reset_anim(type) 110 110 kwargs = { 111 'delay' : int(self.delay_slider. getValue()),111 'delay' : int(self.delay_slider.value), 112 112 'callback' : None, 113 113 'repeat' : 0, -
trunk/demos/pychan_demo/sliders.py
r3441 r3786 2 2 3 3 # #################################################################### 4 # Copyright (C) 2005-20 09by the FIFE team5 # http://www.fifengine. de4 # Copyright (C) 2005-2011 by the FIFE team 5 # http://www.fifengine.net 6 6 # This file is part of FIFE. 7 7 # … … 57 57 pbar = self.widget.findChild(name="pbar") 58 58 59 pbar.value = int(pbarslider. getValue())59 pbar.value = int(pbarslider.value) -
trunk/engine/python/fife/extensions/pychan/__init__.py
r3748 r3786 2 2 3 3 # #################################################################### 4 # Copyright (C) 2005-20 09by the FIFE team5 # http://www.fifengine. de4 # Copyright (C) 2005-2011 by the FIFE team 5 # http://www.fifengine.net 6 6 # This file is part of FIFE. 7 7 # -
trunk/engine/python/fife/extensions/pychan/attrs.py
r3541 r3786 2 2 3 3 # #################################################################### 4 # Copyright (C) 2005-20 09by the FIFE team5 # http://www.fifengine. de4 # Copyright (C) 2005-2011 by the FIFE team 5 # http://www.fifengine.net 6 6 # This file is part of FIFE. 7 7 # -
trunk/engine/python/fife/extensions/pychan/internal.py
r3697 r3786 2 2 3 3 # #################################################################### 4 # Copyright (C) 2005-20 09by the FIFE team5 # http://www.fifengine. de4 # Copyright (C) 2005-2011 by the FIFE team 5 # http://www.fifengine.net 6 6 # This file is part of FIFE. 7 7 # -
trunk/engine/python/fife/extensions/pychan/properties.py
r3541 r3786 2 2 3 3 # #################################################################### 4 # Copyright (C) 2005-20 09by the FIFE team5 # http://www.fifengine. de4 # Copyright (C) 2005-2011 by the FIFE team 5 # http://www.fifengine.net 6 6 # This file is part of FIFE. 7 7 # -
trunk/engine/python/fife/extensions/pychan/widgets/__init__.py
r3697 r3786 2 2 3 3 # #################################################################### 4 # Copyright (C) 2005-20 09by the FIFE team5 # http://www.fifengine. de4 # Copyright (C) 2005-2011 by the FIFE team 5 # http://www.fifengine.net 6 6 # This file is part of FIFE. 7 7 # -
trunk/engine/python/fife/extensions/pychan/widgets/basictextwidget.py
r3785 r3786 2 2 3 3 # #################################################################### 4 # Copyright (C) 2005-20 09by the FIFE team5 # http://www.fifengine. de4 # Copyright (C) 2005-2011 by the FIFE team 5 # http://www.fifengine.net 6 6 # This file is part of FIFE. 7 7 # … … 44 44 DEFAULT_HEXPAND = 1 45 45 DEFAULT_VEXPAND = 0 46 DEFAULT_MARGINS = 5,5 47 DEFAULT_TEXT = u"" 46 48 47 49 def __init__(self, 48 50 parent = None, 49 name = Widget.DEFAULT_NAME,50 size = Widget.DEFAULT_SIZE,51 min_size = Widget.DEFAULT_MIN_SIZE,52 max_size = Widget.DEFAULT_MAX_SIZE,53 helptext = Widget.DEFAULT_HELPTEXT,54 position = Widget.DEFAULT_POSITION,51 name = None, 52 size = None, 53 min_size = None, 54 max_size = None, 55 helptext = None, 56 position = None, 55 57 style = None, 56 hexpand = None, 58 hexpand = None, 57 59 vexpand = None, 58 text = u""): 60 font = None, 61 base_color = None, 62 background_color = None, 63 foreground_color = None, 64 selection_color = None, 65 border_size = None, 66 position_technique = None, 67 is_focusable = None, 68 comment = None, 69 margins = None, 70 text = None): 59 71 60 self.margins = (5,5)61 self.text = text72 self.margins = self.DEFAULT_MARGINS 73 self.text = self.DEFAULT_TEXT 62 74 super(BasicTextWidget,self).__init__(parent=parent, 63 75 name=name, … … 69 81 style=style, 70 82 hexpand=hexpand, 71 vexpand=vexpand) 83 vexpand=vexpand, 84 font=font, 85 base_color=base_color, 86 background_color=background_color, 87 foreground_color=foreground_color, 88 selection_color=selection_color, 89 border_size=border_size, 90 position_technique=position_technique, 91 is_focusable=is_focusable, 92 comment=comment) 72 93 73 94 # Prepare Data collection framework 74 95 self.accepts_initial_data = True 75 96 self._realSetInitialData = self._setText 97 98 # Override anything set when stylize was called 99 if margins is not None: self.margins = margins 100 if text is not None: self.text = text 76 101 77 102 def _getText(self): return gui2text(self.real_widget.getCaption()) 78 103 def _setText(self,text): self.real_widget.setCaption(text2gui(text)) 104 79 105 text = property(_getText,_setText) 80 106 -
trunk/engine/python/fife/extensions/pychan/widgets/buttons.py
r3785 r3786 2 2 3 3 # #################################################################### 4 # Copyright (C) 2005-20 09by the FIFE team5 # http://www.fifengine. de4 # Copyright (C) 2005-2011 by the FIFE team 5 # http://www.fifengine.net 6 6 # This file is part of FIFE. 7 7 # … … 32 32 def __init__(self, 33 33 parent = None, 34 name = BasicTextWidget.DEFAULT_NAME,35 size = BasicTextWidget.DEFAULT_SIZE,36 min_size = BasicTextWidget.DEFAULT_MIN_SIZE,37 max_size = BasicTextWidget.DEFAULT_MAX_SIZE,38 helptext = BasicTextWidget.DEFAULT_HELPTEXT,39 position = BasicTextWidget.DEFAULT_POSITION,34 name = None, 35 size = None, 36 min_size = None, 37 max_size = None, 38 helptext = None, 39 position = None, 40 40 style = None, 41 hexpand = None, 41 hexpand = None, 42 42 vexpand = None, 43 text = u""): 43 font = None, 44 base_color = None, 45 background_color = None, 46 foreground_color = None, 47 selection_color = None, 48 border_size = None, 49 position_technique = None, 50 is_focusable = None, 51 comment = None, 52 margins = None, 53 text = None): 44 54 45 55 self.real_widget = fife.Button("") … … 54 64 hexpand=hexpand, 55 65 vexpand=vexpand, 66 font=font, 67 base_color=base_color, 68 background_color=background_color, 69 foreground_color=foreground_color, 70 selection_color=selection_color, 71 border_size=border_size, 72 position_technique=position_technique, 73 is_focusable=is_focusable, 74 comment=comment, 75 margins=margins, 56 76 text=text) 57 77 … … 76 96 ] 77 97 98 DEFAULT_UPIMAGE = "" 99 DEFAULT_DOWNIMAGE = "" 100 DEFAULT_HOVERIMAGE = "" 101 DEFAULT_OFFSET = 0,0 78 102 def __init__(self, 79 103 parent = None, 80 name = BasicTextWidget.DEFAULT_NAME,81 size = BasicTextWidget.DEFAULT_SIZE,82 min_size = BasicTextWidget.DEFAULT_MIN_SIZE,83 max_size = BasicTextWidget.DEFAULT_MAX_SIZE,84 helptext = BasicTextWidget.DEFAULT_HELPTEXT,85 position = BasicTextWidget.DEFAULT_POSITION,104 name = None, 105 size = None, 106 min_size = None, 107 max_size = None, 108 helptext = None, 109 position = None, 86 110 style = None, 87 hexpand = None, 111 hexpand = None, 88 112 vexpand = None, 89 text = u"", 90 up_image="", 91 down_image="", 92 hover_image="", 93 offset=(0,0), 113 font = None, 114 base_color = None, 115 background_color = None, 116 foreground_color = None, 117 selection_color = None, 118 border_size = None, 119 position_technique = None, 120 is_focusable = None, 121 comment = None, 122 margins = None, 123 text = None, 124 up_image=None, 125 down_image=None, 126 hover_image=None, 127 offset=None, 94 128 real_widget=None): 95 129 … … 98 132 else: 99 133 self.real_widget = real_widget 100 134 135 # set the defaulst 136 offset = self.DEFAULT_OFFSET 137 101 138 super(ImageButton,self).__init__(parent=parent, 102 139 name=name, … … 109 146 hexpand=hexpand, 110 147 vexpand=vexpand, 148 font=font, 149 base_color=base_color, 150 background_color=background_color, 151 foreground_color=foreground_color, 152 selection_color=selection_color, 153 border_size=border_size, 154 position_technique=position_technique, 155 is_focusable=is_focusable, 156 comment=comment, 157 margins=margins, 111 158 text=text) 112 113 self.up_image = up_image 114 self.down_image = down_image 115 self.hover_image = hover_image 116 self.offset = offset 159 160 if up_image is not None: 161 self.up_image = up_image 162 else: 163 self.up_image = self.DEFAULT_UPIMAGE 164 165 if down_image is not None: 166 self.down_image = down_image 167 else: 168 self.down_image = self.DEFAULT_DOWNIMAGE 169 170 if hover_image is not None: 171 self.hover_image = hover_image 172 else: 173 self.hover_image = self.DEFAULT_HOVERIMAGE 174 175 # Override anything set when stylize was called 176 if offset is not None: self.offset = offset 117 177 118 178 up_image = ImageProperty("UpImage") … … 161 221 Attr('group') 162 222 ] 223 DEFAULT_GROUP = "" 163 224 164 225 def __init__(self, 165 226 parent = None, 166 name = BasicTextWidget.DEFAULT_NAME,167 size = BasicTextWidget.DEFAULT_SIZE,168 min_size = BasicTextWidget.DEFAULT_MIN_SIZE,169 max_size = BasicTextWidget.DEFAULT_MAX_SIZE,170 helptext = BasicTextWidget.DEFAULT_HELPTEXT,171 position = BasicTextWidget.DEFAULT_POSITION,227 name = None, 228 size = None, 229 min_size = None, 230 max_size = None, 231 helptext = None, 232 position = None, 172 233 style = None, 173 hexpand = None, 234 hexpand = None, 174 235 vexpand = None, 175 text = u"", 176 up_image = "", 177 down_image = "", 178 hover_image = "", 179 offset = (0,0), 180 group = ""): 236 font = None, 237 base_color = None, 238 background_color = None, 239 foreground_color = None, 240 selection_color = None, 241 border_size = None, 242 position_technique = None, 243 is_focusable = None, 244 comment = None, 245 margins = None, 246 text = None, 247 up_image = None, 248 down_image = None, 249 hover_image = None, 250 offset = None, 251 group = None): 252 253 group = self.DEFAULT_GROUP 181 254 182 255 super(ToggleButton,self).__init__(parent=parent, … … 190 263 hexpand=hexpand, 191 264 vexpand=vexpand, 192 text=text, 193 real_widget=fife.ToggleButton(), 194 up_image=up_image, 195 down_image=down_image, 265 font=font, 266 base_color=base_color, 267 background_color=background_color, 268 foreground_color=foreground_color, 269 selection_color=selection_color, 270 border_size=border_size, 271 position_technique=position_technique, 272 is_focusable=is_focusable, 273 comment=comment, 274 margins=margins, 275 text=text, 276 up_image=up_image, 277 down_image=down_image, 196 278 hover_image=hover_image, 197 offset=offset) 198 self.group = group 279 offset=offset, 280 real_widget=fife.ToggleButton()) 281 282 if group is not None: self.group = group 199 283 200 284 def _setGroup(self,group): 201 self.real_widget.setGroup( group ) 285 if group is not None and group != "": 286 self.real_widget.setGroup( group ) 202 287 203 288 def _getGroup(self): -
trunk/engine/python/fife/extensions/pychan/widgets/checkbox.py
r3785 r3786 2 2 3 3 # #################################################################### 4 # Copyright (C) 2005-20 09by the FIFE team5 # http://www.fifengine. de4 # Copyright (C) 2005-2011 by the FIFE team 5 # http://www.fifengine.net 6 6 # This file is part of FIFE. 7 7 # … … 41 41 ATTRIBUTES = BasicTextWidget.ATTRIBUTES + [ BoolAttr('marked') ] 42 42 43 DEFAULT_MARKED = False 44 43 45 def __init__(self, 44 46 parent = None, 45 name = BasicTextWidget.DEFAULT_NAME,46 size = BasicTextWidget.DEFAULT_SIZE,47 min_size = BasicTextWidget.DEFAULT_MIN_SIZE,48 max_size = BasicTextWidget.DEFAULT_MAX_SIZE,49 helptext = BasicTextWidget.DEFAULT_HELPTEXT,50 position = BasicTextWidget.DEFAULT_POSITION,47 name = None, 48 size = None, 49 min_size = None, 50 max_size = None, 51 helptext = None, 52 position = None, 51 53 style = None, 52 hexpand = None, 54 hexpand = None, 53 55 vexpand = None, 54 text = u"", 55 marked = False): 56 font = None, 57 base_color = None, 58 background_color = None, 59 foreground_color = None, 60 selection_color = None, 61 border_size = None, 62 position_technique = None, 63 is_focusable = None, 64 comment = None, 65 margins = None, 66 text = None, 67 marked = None): 56 68 57 69 self.real_widget = fife.CheckBox() 58 self.marked = marked70 self.marked = self.DEFAULT_MARKED 59 71 super(CheckBox,self).__init__(parent=parent, 60 72 name=name, … … 67 79 hexpand=hexpand, 68 80 vexpand=vexpand, 81 font=font, 82 base_color=base_color, 83 background_color=background_color, 84 foreground_color=foreground_color, 85 selection_color=selection_color, 86 border_size=border_size, 87 position_technique=position_technique, 88 is_focusable=is_focusable, 89 comment=comment, 90 margins=margins, 69 91 text=text) 92 93 if marked is not None: 94 self.marked = marked 70 95 71 96 # Prepare Data collection framework … … 74 99 self._realSetData = self._setMarked 75 100 76 # Initial data stuff inherited.77 78 101 def _isMarked(self): return self.real_widget.isSelected() 79 102 def _setMarked(self,mark): self.real_widget.setSelected(mark) -
trunk/engine/python/fife/extensions/pychan/widgets/common.py
r3541 r3786 2 2 3 3 # #################################################################### 4 # Copyright (C) 2005-20 09by the FIFE team5 # http://www.fifengine. de4 # Copyright (C) 2005-2011 by the FIFE team 5 # http://www.fifengine.net 6 6 # This file is part of FIFE. 7 7 # -
trunk/engine/python/fife/extensions/pychan/widgets/containers.py
r3785 r3786 2 2 3 3 # #################################################################### 4 # Copyright (C) 2005-20 09by the FIFE team5 # http://www.fifengine. de4 # Copyright (C) 2005-2011 by the FIFE team 5 # http://www.fifengine.net 6 6 # This file is part of FIFE. 7 7 # … … 50 50 ] 51 51 52 DEFAULT_OPAQUE = True 53 DEFAULT_MARGINS = 5,5 54 DEFAULT_PADDING = 5 55 DEFAULT_BACKGROUND = None 56 52 57 def __init__(self, 53 58 parent = None, 54 name = Widget.DEFAULT_NAME,55 size = Widget.DEFAULT_SIZE,56 min_size = Widget.DEFAULT_MIN_SIZE,57 max_size = Widget.DEFAULT_MAX_SIZE,58 helptext = Widget.DEFAULT_HELPTEXT,59 position = Widget.DEFAULT_POSITION,59 name = None, 60 size = None, 61 min_size = None, 62 max_size = None, 63 helptext = None, 64 position = None, 60 65 style = None, 61 hexpand = None, 66 hexpand = None, 62 67 vexpand = None, 63 padding = 5, 68 font = None, 69 base_color = None, 70 background_color = None, 71 foreground_color = None, 72 selection_color = None, 73 border_size = None, 74 position_technique = None, 75 is_focusable = None, 76 comment = None, 77 padding = None, 64 78 background_image = None, 65 opaque = True,66 margins = (5,5),79 opaque = None, 80 margins = None, 67 81 _real_widget = None): 68 82 69 83 self.real_widget = _real_widget or fife.Container() 70 self._background = []71 self._background_image = None72 self.background_image = background_image73 84 self.children = [] 74 85 self.children_position_cache = [] 75 86 self.hidden_children = [] 76 self.margins = margins 77 self.padding = padding 78 self.opaque = opaque 87 self._background = [] 88 self._background_image = None 89 self.background_image = self.DEFAULT_BACKGROUND 90 self.margins = self.DEFAULT_MARGINS 91 self.padding = self.DEFAULT_PADDING 92 self.opaque = self.DEFAULT_OPAQUE 79 93 80 94 super(Container,self).__init__(parent=parent, … … 87 101 style=style, 88 102 hexpand=hexpand, 89 vexpand=vexpand) 103 vexpand=vexpand, 104 font=font, 105 base_color=base_color, 106 background_color=background_color, 107 foreground_color=foreground_color, 108 selection_color=selection_color, 109 border_size=border_size, 110 position_technique=position_technique, 111 is_focusable=is_focusable, 112 comment=comment) 113 114 if margins is not None: self.margins = margins 115 if padding is not None: self.padding = padding 116 if opaque is not None: self.opaque = opaque 117 if background_image is not None: self.background_image = background_image 90 118 91 119 def addChild(self, widget): … … 209 237 self._background = getattr(self,'_background',None) 210 238 if image is None: 211 self._background_image = image239 self._background_image = None 212 240 map(self.real_widget.remove,self._background) 213 241 self._background = [] … … 242 270 DEFAULT_VEXPAND = 1 243 271 244 def __init__(self, 272 def __init__(self, 245 273 parent = None, 246 name = Widget.DEFAULT_NAME,247 size = Widget.DEFAULT_SIZE,248 min_size = Widget.DEFAULT_MIN_SIZE,249 max_size = Widget.DEFAULT_MAX_SIZE,250 helptext = Widget.DEFAULT_HELPTEXT,251 position = Widget.DEFAULT_POSITION,274 name = None, 275 size = None, 276 min_size = None, 277 max_size = None, 278 helptext = None, 279 position = None, 252 280 style = None, 253 hexpand = None, 281 hexpand = None, 254 282 vexpand = None, 255 padding = 5, 283 font = None, 284 base_color = None, 285 background_color = None, 286 foreground_color = None, 287 selection_color = None, 288 border_size = None, 289 position_technique = None, 290 is_focusable = None, 291 comment = None, 292 padding = None, 256 293 background_image = None, 257 opaque = True,258 margins = (5,5),294 opaque = None, 295 margins = None, 259 296 _real_widget = None): 260 297 … … 269 306 hexpand=hexpand, 270 307 vexpand=vexpand, 308 font=font, 309 base_color=base_color, 310 background_color=background_color, 311 foreground_color=foreground_color, 312 selection_color=selection_color, 313 border_size=border_size, 314 position_technique=position_technique, 315 is_focusable=is_focusable, 316 comment=comment, 271 317 padding=padding, 272 318 background_image=background_image, … … 274 320 margins=margins, 275 321 _real_widget=_real_widget) 276 self.padding = padding277 322 278 323 … … 286 331 DEFAULT_VEXPAND = 0 287 332 288 def __init__(self, 333 def __init__(self, 289 334 parent = None, 290 name = Widget.DEFAULT_NAME,291 size = Widget.DEFAULT_SIZE,292 min_size = Widget.DEFAULT_MIN_SIZE,293 max_size = Widget.DEFAULT_MAX_SIZE,294 helptext = Widget.DEFAULT_HELPTEXT,295 position = Widget.DEFAULT_POSITION,335 name = None, 336 size = None, 337 min_size = None, 338 max_size = None, 339 helptext = None, 340 position = None, 296 341 style = None, 297 hexpand = None, 342 hexpand = None, 298 343 vexpand = None, 299 padding = 5, 344 font = None, 345 base_color = None, 346 background_color = None, 347 foreground_color = None, 348 selection_color = None, 349 border_size = None, 350 position_technique = None, 351 is_focusable = None, 352 comment = None, 353 padding = None, 300 354 background_image = None, 301 opaque = True,302 margins = (5,5),355 opaque = None, 356 margins = None, 303 357 _real_widget = None): 304 358 … … 313 367 hexpand=hexpand, 314 368 vexpand=vexpand, 369 font=font, 370 base_color=base_color, 371 background_color=background_color, 372 foreground_color=foreground_color, 373 selection_color=selection_color, 374 border_size=border_size, 375 position_technique=position_technique, 376 is_focusable=is_focusable, 377 comment=comment, 315 378 padding=padding, 316 379 background_image=background_image, … … 318 381 margins=margins, 319 382 _real_widget=_real_widget) 320 self.padding = padding321 383 322 384 class Window(VBoxLayoutMixin,Container): … … 335 397 ] 336 398 337 def __init__(self, 399 DEFAULT_TITLE = u"title" 400 DEFAULT_TITLE_HEIGHT = 0 401 DEFAULT_POSITION_TECHNIQUE = "automatic" 402 403 def __init__(self, 338 404 parent = None, 339 name = Widget.DEFAULT_NAME,340 size = Widget.DEFAULT_SIZE,341 min_size = Widget.DEFAULT_MIN_SIZE,342 max_size = Widget.DEFAULT_MAX_SIZE,343 helptext = Widget.DEFAULT_HELPTEXT,344 position = Widget.DEFAULT_POSITION,405 name = None, 406 size = None, 407 min_size = None, 408 max_size = None, 409 helptext = None, 410 position = None, 345 411 style = None, 346 hexpand = None, 412 hexpand = None, 347 413 vexpand = None, 348 padding = 5, 414 font = None, 415 base_color = None, 416 background_color = None, 417 foreground_color = None, 418 selection_color = None, 419 border_size = None, 420 position_technique = None, 421 is_focusable = None, 422 comment = None, 423 padding = None, 349 424 background_image = None, 350 margins = (5,5), 425 opaque = None, 426 margins = None, 351 427 _real_widget = None, 352 title = u"title",353 titlebar_height = 0):354 428 title = None, 429 titlebar_height = None): 430 355 431 super(Window,self).__init__(parent=parent, 356 432 name=name, … … 363 439 hexpand=hexpand, 364 440 vexpand=vexpand, 441 font=font, 442 base_color=base_color, 443 background_color=background_color, 444 foreground_color=foreground_color, 445 selection_color=selection_color, 446 border_size=border_size, 447 position_technique=position_technique, 448 is_focusable=is_focusable, 449 comment=comment, 365 450 padding=padding, 366 451 background_image=background_image, 452 opaque=opaque, 367 453 margins=margins, 368 454 _real_widget= fife.Window()) 369 if titlebar_height == 0: 370 titlebar_height = self.real_font.getHeight() + 4 371 self.titlebar_height = titlebar_height 372 self.title = title 373 374 # Override explicit positioning 375 self.position_technique = "automatic" 376 455 456 if titlebar_height is not None: 457 if titlebar_height == 0: 458 titlebar_height = self.real_font.getHeight() + 4 459 self.titlebar_height = titlebar_height 460 else: 461 self.titlebar_height = self.real_font.getHeight() + 4 462 463 if title is not None: 464 self.title = title 465 else: 466 self.title = self.DEFAULT_TITLE 377 467 378 468 def _getTitle(self): return gui2text(self.real_widget.getCaption()) -
trunk/engine/python/fife/extensions/pychan/widgets/dropdown.py
r3785 r3786 2 2 3 3 # #################################################################### 4 # Copyright (C) 2005-20 09by the FIFE team5 # http://www.fifengine. de4 # Copyright (C) 2005-2011 by the FIFE team 5 # http://www.fifengine.net 6 6 # This file is part of FIFE. 7 7 # … … 44 44 The list items can be set via L{distributeInitialData}. 45 45 """ 46 47 DEFAULT_ITEMS = [] 48 46 49 def __init__(self, 47 50 parent = None, 48 name = Widget.DEFAULT_NAME,49 size = Widget.DEFAULT_SIZE,50 min_size = Widget.DEFAULT_MIN_SIZE,51 max_size = Widget.DEFAULT_MAX_SIZE,52 helptext = Widget.DEFAULT_HELPTEXT,53 position = Widget.DEFAULT_POSITION,51 name = None, 52 size = None, 53 min_size = None, 54 max_size = None, 55 helptext = None, 56 position = None, 54 57 style = None, 55 hexpand = None, 58 hexpand = None, 56 59 vexpand = None, 57 items=[]): 58 59 self._items = GenericListmodel(*items) 60 font = None, 61 base_color = None, 62 background_color = None, 63 foreground_color = None, 64 selection_color = None, 65 border_size = None, 66 position_technique = None, 67 is_focusable = None, 68 comment = None, 69 items = None, 70 selected = None): 71 72 if items is None: 73 self._items = GenericListmodel(*self.DEFAULT_ITEMS) 74 else: 75 if type(items) is list: 76 self._items = GenericListmodel(*items) 77 else: 78 raise RuntimeError("items parameter must be a list!") 79 80 if selected is not None and items is not None: 81 if len(items) > 0 and selected < len(items) and selected > 0: 82 self.selected = selected 83 else: 84 raise RuntimeError("Invalid selected item index specified for dropdown!") 85 elif selected is None and items is not None: 86 if len(items) > 0: 87 self.selected = 0 88 60 89 self.real_widget = fife.DropDown(self._items) 61 90 super(DropDown,self).__init__(parent=parent, … … 68 97 style=style, 69 98 hexpand=hexpand, 70 vexpand=vexpand) 99 vexpand=vexpand, 100 font=font, 101 base_color=base_color, 102 background_color=background_color, 103 foreground_color=foreground_color, 104 selection_color=selection_color, 105 border_size=border_size, 106 position_technique=position_technique, 107 is_focusable=is_focusable, 108 comment=comment) 71 109 72 110 # Prepare Data collection framework -
trunk/engine/python/fife/extensions/pychan/widgets/icon.py
r3785 r3786 2 2 3 3 # #################################################################### 4 # Copyright (C) 2005-20 09by the FIFE team5 # http://www.fifengine. de4 # Copyright (C) 2005-2011 by the FIFE team 5 # http://www.fifengine.net 6 6 # This file is part of FIFE. 7 7 # … … 37 37 ATTRIBUTES = Widget.ATTRIBUTES + [ Attr('image') ] 38 38 39 def __init__(self, 39 def __init__(self, 40 40 parent = None, 41 name = Widget.DEFAULT_NAME,42 size = Widget.DEFAULT_SIZE,43 min_size = Widget.DEFAULT_MIN_SIZE,44 max_size = Widget.DEFAULT_MAX_SIZE,45 helptext = Widget.DEFAULT_HELPTEXT,46 position = Widget.DEFAULT_POSITION,41 name = None, 42 size = None, 43 min_size = None, 44 max_size = None, 45 helptext = None, 46 position = None, 47 47 style = None, 48 hexpand = None, 48 hexpand = None, 49 49 vexpand = None, 50 font = None, 51 base_color = None, 52 background_color = None, 53 foreground_color = None, 54 selection_color = None, 55 border_size = None, 56 position_technique = None, 57 is_focusable = None, 58 comment = None, 50 59 image = None): 51 60 … … 60 69 style=style, 61 70 hexpand=hexpand, 62 vexpand=vexpand) 71 vexpand=vexpand, 72 font=font, 73 base_color=base_color, 74 background_color=background_color, 75 foreground_color=foreground_color, 76 selection_color=selection_color, 77 border_size=border_size, 78 position_technique=position_technique, 79 is_focusable=is_focusable, 80 comment=comment) 63 81 self.image = image 64 82 -
trunk/engine/python/fife/extensions/pychan/widgets/label.py
r3785 r3786 2 2 3 3 # #################################################################### 4 # Copyright (C) 2005-20 09by the FIFE team5 # http://www.fifengine. de4 # Copyright (C) 2005-2011 by the FIFE team 5 # http://www.fifengine.net 6 6 # This file is part of FIFE. 7 7 # … … 43 43 ATTRIBUTES = BasicTextWidget.ATTRIBUTES + [ BoolAttr('wrap_text') ] 44 44 45 DEFAULT_WRAP_TEXT = False 46 45 47 def __init__(self, 46 48 parent = None, 47 name = BasicTextWidget.DEFAULT_NAME,48 size = BasicTextWidget.DEFAULT_SIZE,49 min_size = BasicTextWidget.DEFAULT_MIN_SIZE,50 max_size = BasicTextWidget.DEFAULT_MAX_SIZE,51 helptext = BasicTextWidget.DEFAULT_HELPTEXT,52 position = BasicTextWidget.DEFAULT_POSITION,49 name = None, 50 size = None, 51 min_size = None, 52 max_size = None, 53 helptext = None, 54 position = None, 53 55 style = None, 54 hexpand = None, 56 hexpand = None, 55 57 vexpand = None, 56 text = u"", 57 wrap_text = False): 58 font = None, 59 base_color = None, 60 background_color = None, 61 foreground_color = None, 62 selection_color = None, 63 border_size = None, 64 position_technique = None, 65 is_focusable = None, 66 comment = None, 67 margins = None, 68 text = None, 69 wrap_text = None): 58 70 59 71 self.real_widget = fife.Label("") 60 self.wrap_text = wrap_text72 self.wrap_text = self.DEFAULT_WRAP_TEXT 61 73 super(Label,self).__init__(parent=parent, 62 74 name=name, … … 69 81 hexpand=hexpand, 70 82 vexpand=vexpand, 83 font=font, 84 base_color=base_color, 85 background_color=background_color, 86 foreground_color=foreground_color, 87 selection_color=selection_color, 88 border_size=border_size, 89 position_technique=position_technique, 90 is_focusable=is_focusable, 91 comment=comment, 92 margins=margins, 71 93 text=text) 94 95 if wrap_text is not None: self.wrap_text = wrap_text 72 96 73 97 def resizeToContent(self, recurse=True): -
trunk/engine/python/fife/extensions/pychan/widgets/layout.py
r3541 r3786 2 2 3 3 # #################################################################### 4 # Copyright (C) 2005-20 09by the FIFE team5 # http://www.fifengine. de4 # Copyright (C) 2005-2011 by the FIFE team 5 # http://www.fifengine.net 6 6 # This file is part of FIFE. 7 7 # -
trunk/engine/python/fife/extensions/pychan/widgets/listbox.py
r3785 r3786 2 2 3 3 # #################################################################### 4 # Copyright (C) 2005-20 09by the FIFE team5 # http://www.fifengine. de4 # Copyright (C) 2005-2011 by the FIFE team 5 # http://www.fifengine.net 6 6 # This file is part of FIFE. 7 7 # … … 64 64 DEFAULT_HEXPAND = 1 65 65 DEFAULT_VEXPAND = 1 66 67 def __init__(self, 66 DEFAULT_ITEMS = [] 67 68 def __init__(self, 68 69 parent = None, 69 name = Widget.DEFAULT_NAME,70 size = Widget.DEFAULT_SIZE,71 min_size = Widget.DEFAULT_MIN_SIZE,72 max_size = Widget.DEFAULT_MAX_SIZE,73 helptext = Widget.DEFAULT_HELPTEXT,74 position = Widget.DEFAULT_POSITION,75 style = None, 76 hexpand = None, 70 name = None, 71 size = None, 72 min_size = None, 73 max_size = None, 74 helptext = None, 75 position = None, 76 style = None, 77 hexpand = None, 77 78 vexpand = None, 78 items = [], 79 font = None, 80 base_color = None, 81 background_color = None, 82 foreground_color = None, 83 selection_color = None, 84 border_size = None, 85 position_technique = None, 86 is_focusable = None, 87 comment = None, 88 items = None, 79 89 selected = None): 80 90 81 self._items = GenericListmodel(*items) 91 if items is None: 92 self._items = GenericListmodel(*self.DEFAULT_ITEMS) 93 else: 94 if type(items) is list: 95 self._items = GenericListmodel(*items) 96 else: 97 raise RuntimeError("items parameter must be a list!") 98 82 99 self.real_widget = fife.ListBox(self._items) 83 if selected is not None: 84 self.selected = selected 100 101 if selected is not None and items is not None: 102 if len(items) > 0 and selected < len(items) and selected > 0: 103 self.selected = selected 104 else: 105 raise RuntimeError("Invalid selected item index specified for listbox!") 106 elif selected is None and items is not None: 107 if len(items) > 0: 108 self.selected = 0 109 85 110 super(ListBox,self).__init__(parent=parent, 86 111 name=name, … … 92 117 style=style, 93 118 hexpand=hexpand, 94 vexpand=vexpand) 119 vexpand=vexpand, 120 font=font, 121 base_color=base_color, 122 background_color=background_color, 123 foreground_color=foreground_color, 124 selection_color=selection_color, 125 border_size=border_size, 126 position_technique=position_technique, 127 is_focusable=is_focusable, 128 comment=comment) 95 129 96 130 # Prepare Data collection framework -
trunk/engine/python/fife/extensions/pychan/widgets/percentagebar.py
r3785 r3786 2 2 3 3 # #################################################################### 4 # Copyright (C) 2005-201 0by the FIFE team4 # Copyright (C) 2005-2011 by the FIFE team 5 5 # http://www.fifengine.net 6 6 # This file is part of FIFE. … … 39 39 VERTICAL = fife.PercentageBar.VERTICAL 40 40 41 ATTRIBUTES = Widget.ATTRIBUTES + [IntAttr('orientation'), IntAttr('value')] 41 ATTRIBUTES = Widget.ATTRIBUTES + [ IntAttr('orientation'), 42 IntAttr('value') 43 ] 42 44 DEFAULT_HEXPAND = 1 43 45 DEFAULT_VEXPAND = 0 44 46 DEFAULT_MIN_SIZE = 10,10 47 DEFAULT_VALUE = 0 48 DEFAULT_ORIENTATION = HORIZONTAL 49 45 50 def __init__(self, 46 51 parent = None, 47 name = Widget.DEFAULT_NAME,48 size = Widget.DEFAULT_SIZE,49 min_size = (10,10),50 max_size = Widget.DEFAULT_MAX_SIZE,51 helptext = Widget.DEFAULT_HELPTEXT,52 position = Widget.DEFAULT_POSITION,52 name = None, 53 size = None, 54 min_size = None, 55 max_size = None, 56 helptext = None, 57 position = None, 53 58 style = None, 54 hexpand = None, 59 hexpand = None, 55 60 vexpand = None, 56 value = 0, 57 orientation = HORIZONTAL): 61 font = None, 62 base_color = None, 63 background_color = None, 64 foreground_color = None, 65 selection_color = None, 66 border_size = None, 67 position_technique = None, 68 is_focusable = None, 69 comment = None, 70 value = None, 71 orientation = None): 58 72 59 73 self.real_widget = fife.PercentageBar() 60 self.orientation = orientation61 self. setOrientation(self.orientation)62 self.setValue(value)74 self.orientation = self.DEFAULT_ORIENTATION 75 self.value = self.DEFAULT_VALUE 76 63 77 super(PercentageBar, self).__init__(parent=parent, 64 name=name, 65 size=size, 66 min_size=min_size, 67 max_size=max_size, 68 helptext=helptext, 69 position=position, 70 style=style, 71 hexpand=hexpand, 72 vexpand=vexpand) 78 name=name, 79 size=size, 80 min_size=min_size, 81 max_size=max_size, 82 helptext=helptext, 83 position=position, 84 style=style, 85 hexpand=hexpand, 86 vexpand=vexpand, 87 font=font, 88 base_color=base_color, 89 background_color=background_color, 90 foreground_color=foreground_color, 91 selection_color=selection_color, 92 border_size=border_size, 93 position_technique=position_technique, 94 is_focusable=is_focusable, 95 comment=comment) 96 97 if orientation is not None: self.orientation = orientation 98 if value is not None: self.value = value 73 99 74 100 self.accepts_data = True 75 self._realSetData = self. setValue76 self._realGetData = self. getValue101 self._realSetData = self._setValue 102 self._realGetData = self._getValue 77 103 78 def getValue(self):104 def _getValue(self): 79 105 """getValue(self) -> int""" 80 106 return self.real_widget.getValue() 81 107 82 def setValue(self, value):108 def _setValue(self, value): 83 109 """setValue(self, int value)""" 84 110 if type(value) != int: 85 111 raise RuntimeError("PercentageBar only accepts integer values") 86 112 self.real_widget.setValue(value) 87 value = property( getValue,setValue)113 value = property(_getValue, _setValue) 88 114 89 def setOrientation(self, orientation):115 def _setOrientation(self, orientation): 90 116 """setOrientation(self, Orientation orientation)""" 91 117 self.real_widget.setOrientation(orientation) 92 118 93 def getOrientation(self):119 def _getOrientation(self): 94 120 """getOrientation(self) -> int""" 95 121 return self.real_widget.getOrientation() 96 orientation = property( getOrientation,setOrientation)122 orientation = property(_getOrientation, _setOrientation) -
trunk/engine/python/fife/extensions/pychan/widgets/radiobutton.py
r3785 r3786 2 2 3 3 # #################################################################### 4 # Copyright (C) 2005-20 09by the FIFE team5 # http://www.fifengine. de4 # Copyright (C) 2005-2011 by the FIFE team 5 # http://www.fifengine.net 6 6 # This file is part of FIFE. 7 7 # … … 44 44 Attr('group') 45 45 ] 46 47 def __init__(self, 46 DEFAULT_GROUP = "_no_group_" 47 48 def __init__(self, 48 49 parent = None, 49 name = BasicTextWidget.DEFAULT_NAME,50 size = BasicTextWidget.DEFAULT_SIZE,51 min_size = BasicTextWidget.DEFAULT_MIN_SIZE,52 max_size = BasicTextWidget.DEFAULT_MAX_SIZE,53 helptext = BasicTextWidget.DEFAULT_HELPTEXT,54 position = BasicTextWidget.DEFAULT_POSITION,50 name = None, 51 size = None, 52 min_size = None, 53 max_size = None, 54 helptext = None, 55 position = None, 55 56 style = None, 56 hexpand = None, 57 hexpand = None, 57 58 vexpand = None, 58 text=u"", 59 group="_no_group_"): 59 font = None, 60 base_color = None, 61 background_color = None, 62 foreground_color = None, 63 selection_color = None, 64 border_size = None, 65 position_technique = None, 66 is_focusable = None, 67 comment = None, 68 margins = None, 69 text = None, 70 group = None): 60 71 61 72 self.real_widget = fife.RadioButton() 73 self.group = self.DEFAULT_GROUP 74 62 75 super(RadioButton,self).__init__(parent=parent, 63 76 name=name, … … 70 83 hexpand=hexpand, 71 84 vexpand=vexpand, 85 font=font, 86 base_color=base_color, 87 background_color=background_color, 88 foreground_color=foreground_color, 89 selection_color=selection_color, 90 border_size=border_size, 91 position_technique=position_technique, 92 is_focusable=is_focusable, 93 comment=comment, 72 94 text=text) 73 95 74 self.group = group96 if group is not None: self.group = group 75 97 76 98 # Prepare Data collection framework -
trunk/engine/python/fife/extensions/pychan/widgets/scrollarea.py
r3785 r3786 2 2 3 3 # #################################################################### 4 # Copyright (C) 2005-20 09by the FIFE team5 # http://www.fifengine. de4 # Copyright (C) 2005-2011 by the FIFE team 5 # http://www.fifengine.net 6 6 # This file is part of FIFE. 7 7 # … … 46 46 def __init__(self, 47 47 parent = None, 48 name = Widget.DEFAULT_NAME,49 size = Widget.DEFAULT_SIZE,50 min_size = Widget.DEFAULT_MIN_SIZE,51 max_size = Widget.DEFAULT_MAX_SIZE,52 helptext = u"",53 position = Widget.DEFAULT_POSITION,48 name = None, 49 size = None, 50 min_size = None, 51 max_size = None, 52 helptext = None, 53 position = None, 54 54 style = None, 55 hexpand = None, 56 vexpand = None): 55 hexpand = None, 56 vexpand = None, 57 font = None, 58 base_color = None, 59 background_color = None, 60 foreground_color = None, 61 selection_color = None, 62 border_size = None, 63 position_technique = None, 64 is_focusable = None, 65 comment = None, 66 content = None, 67 vertical_scrollbar = None, 68 horizontal_scrollbar = None): 57 69 58 70 self.real_widget = fife.ScrollArea() … … 68 80 hexpand=hexpand, 69 81 vexpand=vexpand) 82 83 if content is not None: self.content = content 84 if vertical_scrollbar is not None: self.vertical_scrollbar = vertical_scrollbar 85 if horizontal_scrollbar is not None: self.horizontal_scrollbar = horizontal_scrollbar 70 86 71 87 def addChild(self,widget): -
trunk/engine/python/fife/extensions/pychan/widgets/slider.py
r3785 r3786 2 2 3 3 # #################################################################### 4 # Copyright (C) 2005-201 0by the FIFE team4 # Copyright (C) 2005-2011 by the FIFE team 5 5 # http://www.fifengine.net 6 6 # This file is part of FIFE. … … 54 54 DEFAULT_HEXPAND = 1 55 55 DEFAULT_VEXPAND = 0 56 57 DEFAULT_SIZE = 10,10 58 DEFAULT_MIN_SIZE = 10,10 59 60 DEFAULT_SCALE_START = 0.0 61 DEFAULT_SCALE_END = 1.0 62 DEFAULT_STEP_LENGTH = 0.1 63 DEFAULT_MARKER_LENGTH = 10 64 DEFAULT_ORIENTATION = HORIZONTAL 56 65 57 66 def __init__(self, 58 67 parent = None, 59 name = Widget.DEFAULT_NAME,60 size = Widget.DEFAULT_SIZE,61 min_size =(10,10),62 max_size = Widget.DEFAULT_MAX_SIZE,63 helptext = Widget.DEFAULT_HELPTEXT,64 position = Widget.DEFAULT_POSITION,68 name = None, 69 size = None, 70 min_size = None, 71 max_size = None, 72 helptext = None, 73 position = None, 65 74 style = None, 66 75 hexpand = None, 67 76 vexpand = None, 68 scaleStart = 0.0, 69 scaleEnd = 1.0, 70 orientation = HORIZONTAL): 77 font = None, 78 base_color = None, 79 background_color = None, 80 foreground_color = None, 81 selection_color = None, 82 border_size = None, 83 position_technique = None, 84 is_focusable = None, 85 comment = None, 86 scale_start = None, 87 scale_end = None, 88 step_length = None, 89 marker_length = None, 90 orientation = None): 71 91 72 self.real_widget = fife.Slider(scaleStart, scaleEnd) 73 self.orientation = orientation 74 self.setOrientation(self.orientation) 92 self.real_widget = fife.Slider(scale_start or self.DEFAULT_SCALE_START, scale_end or self.DEFAULT_SCALE_END) 93 self.orientation = self.DEFAULT_ORIENTATION 94 self.step_length = self.DEFAULT_STEP_LENGTH 95 self.marker_length = self.DEFAULT_MARKER_LENGTH 96 75 97 super(Slider, self).__init__(parent=parent, 76 98 name=name, … … 82 104 style=style, 83 105 hexpand=hexpand, 84 vexpand=vexpand) 85 106 vexpand=vexpand, 107 font=font, 108 base_color=base_color, 109 background_color=background_color, 110 foreground_color=foreground_color, 111 selection_color=selection_color, 112 border_size=border_size, 113 position_technique=position_technique, 114 is_focusable=is_focusable, 115 comment=comment) 116 117 if orientation is not None: self.orientation = orientation 118 if scale_start is not None: self.scale_start = scale_start 119 if scale_end is not None: self.scale_end = scale_end 120 if step_length is not None: self.step_lenght = step_length 121 if marker_length is not None: self.marker_length = marker_length 122 86 123 self.accepts_data = True 87 self._realSetData = self. setValue88 self._realGetData = self. getValue124 self._realSetData = self._setValue 125 self._realGetData = self._getValue 89 126 90 127 def _setScale(self, start, end): … … 96 133 self.real_widget.setScale(start, end) 97 134 98 def getScaleStart(self):135 def _getScaleStart(self): 99 136 """getScaleStart(self) -> double""" 100 137 return self.real_widget.getScaleStart() 101 138 102 def setScaleStart(self, start):139 def _setScaleStart(self, start): 103 140 """setScaleStart(self, double scaleStart)""" 104 141 if type(start) != float: 105 142 raise RuntimeError("Slider expects float for start scale") 106 143 self.real_widget.setScaleStart(start) 107 scale_start = property( getScaleStart,setScaleStart)144 scale_start = property(_getScaleStart, _setScaleStart) 108 145 109 def getScaleEnd(self):146 def _getScaleEnd(self): 110 147 """getScaleEnd(self) -> double""" 111 148 return self.real_widget.getScaleEnd() 112 149 113 def setScaleEnd(self, end):150 def _setScaleEnd(self, end): 114 151 """setScaleEnd(self, double scaleEnd)""" 115 152 if type(end) != float: 116 153 raise RuntimeError("Slider expects float for end scale") 117 154 self.real_widget.setScaleEnd(end) 118 scale_end = property( getScaleEnd,setScaleEnd)155 scale_end = property(_getScaleEnd, _setScaleEnd) 119 156 120 def getValue(self):157 def _getValue(self): 121 158 """getValue(self) -> double""" 122 159 return self.real_widget.getValue() 123 160 124 def setValue(self, value):161 def _setValue(self, value): 125 162 """setValue(self, double value)""" 126 163 if type(value) != float: 127 164 raise RuntimeError("Slider only accepts float values") 128 self.real_widget.setValue(value) 165 self.real_widget.setValue(value) 166 value = property(_getValue, _setValue) 129 167 130 def setMarkerLength(self, length):168 def _setMarkerLength(self, length): 131 169 """setMarkerLength(self, int length)""" 132 170 if type(length) != int: … … 134 172 self.real_widget.setMarkerLength(length) 135 173 136 def getMarkerLength(self):174 def _getMarkerLength(self): 137 175 """getMarkerLength(self) -> int""" 138 176 return self.real_widget.getMarkerLength() 139 marker_length = property( getMarkerLength,setMarkerLength)177 marker_length = property(_getMarkerLength, _setMarkerLength) 140 178 141 def setOrientation(self, orientation):179 def _setOrientation(self, orientation): 142 180 """setOrientation(self, Orientation orientation)""" 143 181 self.real_widget.setOrientation(orientation) 144 182 145 def getOrientation(self):183 def _getOrientation(self): 146 184 """getOrientation(self) -> int""" 147 185 return self.real_widget.getOrientation() 148 orientation = property( getOrientation,setOrientation)186 orientation = property(_getOrientation, _setOrientation) 149 187 150 def setStepLength(self, length):188 def _setStepLength(self, length): 151 189 """setStepLength(self, double length)""" 152 190 if type(length) != float: … … 154 192 self.real_widget.setStepLength(length) 155 193 156 def getStepLength(self):194 def _getStepLength(self): 157 195 """getStepLength(self) -> double""" 158 196 return self.real_widget.getStepLength() 159 step_length = property( getStepLength,setStepLength)197 step_length = property(_getStepLength, _setStepLength) -
trunk/engine/python/fife/extensions/pychan/widgets/textbox.py
r3785 r3786 2 2 3 3 # #################################################################### 4 # Copyright (C) 2005-20 09by the FIFE team5 # http://www.fifengine. de4 # Copyright (C) 2005-2011 by the FIFE team 5 # http://www.fifengine.net 6 6 # This file is part of FIFE. 7 7 # … … 45 45 DEFAULT_HEXPAND = 1 46 46 DEFAULT_VEXPAND = 1 47 DEFAULT_TEXT = u"" 48 DEFAULT_FILENAME = "" 47 49 48 50 def __init__(self, 49 51 parent = None, 50 name = Widget.DEFAULT_NAME,51 size = Widget.DEFAULT_SIZE,52 min_size = Widget.DEFAULT_MIN_SIZE,53 max_size = Widget.DEFAULT_MAX_SIZE,54 helptext = Widget.DEFAULT_HELPTEXT,55 position = Widget.DEFAULT_POSITION,52 name = None, 53 size = None, 54 min_size = None, 55 max_size = None, 56 helptext = None, 57 position = None, 56 58 style = None, 57 hexpand = None, 59 hexpand = None, 58 60 vexpand = None, 59 text = u"", 60 filename = ""): 61 font = None, 62 base_color = None, 63 background_color = None, 64 foreground_color = None, 65 selection_color = None, 66 border_size = None, 67 position_technique = None, 68 is_focusable = None, 69 comment = None, 70 margins = None, 71 text = None, 72 filename = None): 61 73 62 74 self.real_widget = fife.TextBox() 63 self.text = text 64 self.filename = filename 75 self.text = text or self.DEFAULT_TEXT 76 self.filename = filename or self.DEFAULT_FILENAME 65 77 super(TextBox,self).__init__(parent=parent, 66 name=name, 67 size=size, 68 min_size=min_size, 69 max_size=max_size, 70 helptext=helptext, 71 position=position, 72 style=style, 73 hexpand=hexpand, 74 vexpand=vexpand) 78 name=name, 79 size=size, 80 min_size=min_size, 81 max_size=max_size, 82 helptext=helptext, 83 position=position, 84 style=style, 85 hexpand=hexpand, 86 vexpand=vexpand, 87 font=font, 88 base_color=base_color, 89 background_color=background_color, 90 foreground_color=foreground_color, 91 selection_color=selection_color, 92 border_size=border_size, 93 position_technique=position_technique, 94 is_focusable=is_focusable, 95 comment=comment) 75 96 76 97 # Prepare Data collection framework -
trunk/engine/python/fife/extensions/pychan/widgets/textfield.py
r3785 r3786 2 2 3 3 # #################################################################### 4 # Copyright (C) 2005-20 09by the FIFE team5 # http://www.fifengine. de4 # Copyright (C) 2005-2011 by the FIFE team 5 # http://www.fifengine.net 6 6 # This file is part of FIFE. 7 7 # … … 42 42 DEFAULT_HEXPAND = 1 43 43 DEFAULT_VEXPAND = 0 44 DEFAULT_TEXT = u"" 44 45 45 def __init__(self, 46 def __init__(self, 46 47 parent = None, 47 name = Widget.DEFAULT_NAME,48 size = Widget.DEFAULT_SIZE,49 min_size = Widget.DEFAULT_MIN_SIZE,50 max_size = Widget.DEFAULT_MAX_SIZE,51 helptext = Widget.DEFAULT_HELPTEXT,52 position = Widget.DEFAULT_POSITION,48 name = None, 49 size = None, 50 min_size = None, 51 max_size = None, 52 helptext = None, 53 position = None, 53 54 style = None, 54 hexpand = None, 55 hexpand = None, 55 56 vexpand = None, 56 text = u""): 57 font = None, 58 base_color = None, 59 background_color = None, 60 foreground_color = None, 61 selection_color = None, 62 border_size = None, 63 position_technique = None, 64 is_focusable = None, 65 comment = None, 66 margins = None, 67 text = None): 57 68 58 69 self.real_widget = fife.TextField() 59 self.text = text 70 self.text = text or self.DEFAULT_TEXT 60 71 super(TextField,self).__init__(parent=parent, 61 72 name=name, -
trunk/engine/python/fife/extensions/pychan/widgets/widget.py
r3785 r3786 2 2 3 3 # #################################################################### 4 # Copyright (C) 2005-20 09by the FIFE team5 # http://www.fifengine. de4 # Copyright (C) 2005-2011 by the FIFE team 5 # http://www.fifengine.net 6 6 # This file is part of FIFE. 7 7 # … … 108 108 DEFAULT_HELPTEXT = u"" 109 109 DEFAULT_POSITION = 0, 0 110 DEFAULT_FONT = "default" 111 DEFAULT_BORDER_SIZE = 0 112 DEFAULT_POSITION_TECHNIQUE = "explicit" 113 DEFAULT_COMMENT = u"" 110 114 111 115 HIDE_SHOW_ERROR = """\ … … 117 121 def __init__(self, 118 122 parent = None, 119 name = DEFAULT_NAME,120 size = DEFAULT_SIZE,121 min_size = DEFAULT_MIN_SIZE,122 max_size = DEFAULT_MAX_SIZE,123 helptext = DEFAULT_HELPTEXT,124 position = DEFAULT_POSITION,123 name = None, 124 size = None, 125 min_size = None, 126 max_size = None, 127 helptext = None, 128 position = None, 125 129 style = None, 126 130 hexpand = None, 127 vexpand = None): 128 131 vexpand = None, 132 font = None, 133 base_color = None, 134 background_color = None, 135 foreground_color = None, 136 selection_color = None, 137 border_size = None, 138 position_technique = None, 139 is_focusable = None, 140 comment = None): 141 142 # Make sure the real_widget has been created 129 143 assert( hasattr(self,'real_widget') ) 144 130 145 self.event_mapper = events.EventMapper(self) 146 131 147 self._visible = False 132 148 self._extra_border = (0,0) 133 self.hexpand = hexpand or self.DEFAULT_HEXPAND134 self.vexpand = vexpand or self.DEFAULT_VEXPAND135 # Simple way to get at least some compat layout:136 if get_manager().compat_layout:137 self.hexpand, self.vexpand = 0,0138 149 139 150 # Data distribution & retrieval settings 140 151 self.accepts_data = False 141 152 self.accepts_initial_data = False 142 153 154 #set all defaults 155 if get_manager().compat_layout: 156 self.hexpand, self.vexpand = 0,0 157 else: 158 self.hexpand = self.DEFAULT_HEXPAND 159 self.vexpand = self.DEFAULT_VEXPAND 160 161 self.name = self.DEFAULT_NAME 162 self.has_name = False 163 self.position = self.DEFAULT_POSITION 164 self.position_technique = self.DEFAULT_POSITION_TECHNIQUE 165 self.font = self.DEFAULT_FONT 166 self.min_size = self.DEFAULT_MIN_SIZE 167 self.max_size = self.DEFAULT_MAX_SIZE 168 self.size = self.DEFAULT_SIZE 169 self.border_size = self.DEFAULT_BORDER_SIZE 170 self.helptext = self.DEFAULT_HELPTEXT 171 self.comment = self.DEFAULT_COMMENT 172 143 173 # Parent attribute makes sure we only have one parent, 144 174 # that tests self.__parent - so make sure we have the attr here. … … 146 176 self.parent = parent 147 177 148 self.has_name = False 149 self.name = name 150 151 self.position = position 152 self.min_size = min_size 153 self.max_size = max_size 154 self.size = size 155 self.position_technique = "explicit" 156 self.font = 'default' 157 158 # Inherit style 178 # Inherit and apply style 159 179 if style is None and parent: 160 180 style = parent.style 161 181 self.style = style or "default" 162 163 self.helptext = helptext 164 self.comment = u"" 165 # Not needed as attrib assignment will trigger manager.stylize call 166 #manager.stylize(self,self.style) 182 183 # override everything style has set 184 if vexpand is not None: self.vexpand = vexpand 185 if hexpand is not None: self.hexpand = hexpand 186 if name is not None: 187 self.name = name 188 self.has_name = True 189 190 if position is not None: self.position = position 191 if position_technique is not None: self.position_technique = position_technique 192 if font is not None: self.font = font 193 194 # only set this if it's provided 195 if is_focusable is not None: self.is_focusable = is_focusable 196 197 if min_size is not None: self.min_size = min_size 198 if max_size is not None: self.max_size = max_size 199 if size is not None: self.size = size 200 if border_size is not None: self.border_size = border_size 201 202 if helptext is not None: self.helptext = helptext 203 if comment is not None: self.comment = comment 204 205 # these are set in the default style 206 if base_color is not None: self.base_color = base_color 207 if background_color is not None: self.background_color = background_color 208 if foreground_color is not None: self.foreground_color = foreground_color 209 if selection_color is not None: self.selection_color = selection_color 167 210 168 211 def execute(self,bind): … … 829 872 def _getParent(self): return self.__parent 830 873 def _setParent(self,parent): 874 if parent and not issubclass(type(parent), Widget): 875 raise RuntimeError("Parent must be subclass of the Widget type.") 876 831 877 if self.__parent is not parent: 832 878 if self.__parent and parent is not None: -
trunk/tests/fife_test/tests/PychanTest.py
r3770 r3786 274 274 pbar = self.widget.findChild(name="pbar") 275 275 276 pbar.value = int(pbarslider. getValue())276 pbar.value = int(pbarslider.value) 277 277 278 278 class ColorExample(PyChanExample): … … 312 312 }) 313 313 # alpha value needs to be set, otherwise you don't see colors ;-) 314 self.widget.findChild(name="base_aslider"). setValue(float(255))315 self.widget.findChild(name="background_aslider"). setValue(float(255))316 self.widget.findChild(name="foreground_aslider"). setValue(float(255))317 self.widget.findChild(name="selection_aslider"). setValue(float(255))314 self.widget.findChild(name="base_aslider").value = float(255) 315 self.widget.findChild(name="background_aslider").value = float(255) 316 self.widget.findChild(name="foreground_aslider").value = float(255) 317 self.widget.findChild(name="selection_aslider").value = float(255) 318 318 319 319 # init stuff … … 328 328 Update rgba base colors of all examples and show the values 329 329 """ 330 r = int(self.widget.findChild(name="base_rslider"). getValue())331 g = int(self.widget.findChild(name="base_gslider"). getValue())332 b = int(self.widget.findChild(name="base_bslider"). getValue())333 a = int(self.widget.findChild(name="base_aslider"). getValue())330 r = int(self.widget.findChild(name="base_rslider").value) 331 g = int(self.widget.findChild(name="base_gslider").value) 332 b = int(self.widget.findChild(name="base_bslider").value) 333 a = int(self.widget.findChild(name="base_aslider").value) 334 334 335 335 # update slider labels … … 355 355 Update rgba background colors of all examples and show the values 356 356 """ 357 r = int(self.widget.findChild(name="background_rslider"). getValue())358 g = int(self.widget.findChild(name="background_gslider"). getValue())359 b = int(self.widget.findChild(name="background_bslider"). getValue())360 a = int(self.widget.findChild(name="background_aslider"). getValue())357 r = int(self.widget.findChild(name="background_rslider").value) 358 g = int(self.widget.findChild(name="background_gslider").value) 359 b = int(self.widget.findChild(name="background_bslider").value) 360 a = int(self.widget.findChild(name="background_aslider").value) 361 361 362 362 # update slider labels … … 382 382 Update rgba selection colors of all examples and show the values 383 383 """ 384 r = int(self.widget.findChild(name="selection_rslider"). getValue())385 g = int(self.widget.findChild(name="selection_gslider"). getValue())386 b = int(self.widget.findChild(name="selection_bslider"). getValue())387 a = int(self.widget.findChild(name="selection_aslider"). getValue())384 r = int(self.widget.findChild(name="selection_rslider").value) 385 g = int(self.widget.findChild(name="selection_gslider").value) 386 b = int(self.widget.findChild(name="selection_bslider").value) 387 a = int(self.widget.findChild(name="selection_aslider").value) 388 388 389 389 # update slider labels … … 409 409 Update rgba foreground colors of all examples and show the values 410 410 """ 411 r = int(self.widget.findChild(name="foreground_rslider"). getValue())412 g = int(self.widget.findChild(name="foreground_gslider"). getValue())413 b = int(self.widget.findChild(name="foreground_bslider"). getValue())414 a = int(self.widget.findChild(name="foreground_aslider"). getValue())411 r = int(self.widget.findChild(name="foreground_rslider").value) 412 g = int(self.widget.findChild(name="foreground_gslider").value) 413 b = int(self.widget.findChild(name="foreground_bslider").value) 414 a = int(self.widget.findChild(name="foreground_aslider").value) 415 415 416 416 # update slider labels … … 448 448 load XML file and setup callbacks 449 449 """ 450 450 451 self.widget = pychan.loadXML(self.xmlFile) 451 452 … … 470 471 471 472 self.delay_slider = self.widget.findChild(name="delay") 472 self.delay_slider. setValue(float(DEFAULT_DELAY))473 self.delay_slider.value = float(DEFAULT_DELAY) 473 474 474 475 self.delay_display = self.widget.findChild(name="delay_label") … … 490 491 def _set_delay_display(self): 491 492 """ set delay display according to slider value """ 492 value = self.delay_slider. getValue()493 value = self.delay_slider.value 493 494 self.delay_display.text = unicode(str(int(value))) 494 495 … … 502 503 self._reset_anim(type) 503 504 kwargs = { 504 'delay' : int(self.delay_slider. getValue()),505 'delay' : int(self.delay_slider.value), 505 506 'callback' : None, 506 507 'repeat' : 0, -
trunk/tools/editor/plugins/ObjectSelector.py
r3694 r3786 46 46 47 47 def __init__(self,callback,**kwargs): 48 super(ObjectIcon,self).__init__( **kwargs)48 super(ObjectIcon,self).__init__() 49 49 50 50 self.callback = callback … … 57 57 58 58 # Icon 59 self.icon = widgets.Icon( **kwargs)59 self.icon = widgets.Icon(image=kwargs["image"]) 60 60 self.addChild(self.icon) 61 61 … … 63 63 hbox = widgets.HBox(padding=1) 64 64 self.addChild(hbox) 65 self.label = widgets.Label( **kwargs)65 self.label = widgets.Label(text=kwargs["text"]) 66 66 hbox.addChild(self.label) 67 67 … … 114 114 115 115 def __init__(self,**kwargs): 116 super(ObjectIconList, self).__init__(max_size=(5000,500000), **kwargs)116 super(ObjectIconList, self).__init__(max_size=(5000,500000), name=kwargs['name']) 117 117 self.base_color = self.background_color 118 118
Note: See TracChangeset
for help on using the changeset viewer.
