Changeset 1212:7c90fe5ca475
- Timestamp:
- 07/25/08 16:16:49 (4 months ago)
- Location:
- pida-plugins/python
- Files:
-
- 9 added
- 4 modified
-
glade/python-source-browser.glade (modified) (1 diff)
-
pixmaps/element-event-16.png (added)
-
pixmaps/source-attribute.png (added)
-
pixmaps/source-class.png (added)
-
pixmaps/source-extramethod.png (added)
-
pixmaps/source-function.png (added)
-
pixmaps/source-import.png (added)
-
pixmaps/source-method.png (added)
-
pixmaps/source-module.png (added)
-
pixmaps/source-property.png (added)
-
python.py (modified) (5 diffs)
-
ropebrowser.py (modified) (14 diffs)
-
test_python.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
pida-plugins/python/glade/python-source-browser.glade
r1014 r1212 1 <?xml version="1.0" encoding="UTF-8" standalone="no"?> 2 <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"> 3 <!--Generated with glade3 3.2.0 on Sun Apr 29 21:06:34 2007 by ali@book--> 1 <?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> 2 <!DOCTYPE glade-interface SYSTEM "http://gazpacho.sicem.biz/gazpacho-0.1.dtd"> 4 3 <glade-interface> 5 6 <widget class="GtkWindow" id="python-source-browser"> 7 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 8 <child> 9 <widget class="GtkVBox" id="main_vbox"> 4 <widget class="GtkWindow" id="python_source_browser"> 10 5 <property name="visible">True</property> 11 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>12 <property name="border_width">6</property>13 6 <child> 14 <widget class="ObjectTree" id="source_tree"> 15 <property name="visible">True</property> 16 <property name="can_focus">True</property> 17 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 18 <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> 19 <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> 20 <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property> 21 </widget> 7 <widget class="GtkVBox" id="main_vbox"> 8 <property name="visible">True</property> 9 <child> 10 <widget class="GtkAlignment" id="alignment1"> 11 <property name="border_width">3</property> 12 <property name="visible">True</property> 13 <child> 14 <widget class="ObjectTree" id="source_tree"> 15 <property name="visible">True</property> 16 <property name="vscrollbar_policy">automatic</property> 17 </widget> 18 </child> 19 </widget> 20 </child> 21 <child> 22 <widget class="GtkExpander" id="options_expander"> 23 <property name="is_focus">True</property> 24 <property name="label" context="yes" translatable="yes">Display Options</property> 25 <property name="visible">True</property> 26 <child> 27 <widget class="GtkHBox" id="hbox1"> 28 <property name="border_width">3</property> 29 <property name="spacing">3</property> 30 <property name="visible">True</property> 31 <child> 32 <widget class="GtkCheckButton" id="show_imports"> 33 <property name="is_focus">True</property> 34 <property name="visible">True</property> 35 <child> 36 <widget class="GtkAlignment" id="alignment30"> 37 <property name="visible">True</property> 38 <child> 39 <widget class="GtkVBox" id="vbox3"> 40 <property name="visible">True</property> 41 <child> 42 <widget class="GtkImage" id="image3"> 43 <property name="file">source-module.png</property> 44 <property name="visible">True</property> 45 </widget> 46 </child> 47 <child> 48 <widget class="GtkLabel" id="label12"> 49 <property name="label" context="yes" translatable="yes">Imports</property> 50 <property name="visible">True</property> 51 </widget> 52 <packing> 53 <property name="position">1</property> 54 </packing> 55 </child> 56 </widget> 57 </child> 58 </widget> 59 </child> 60 </widget> 61 <packing> 62 <property name="expand">False</property> 63 </packing> 64 </child> 65 <child> 66 <widget class="GtkCheckButton" id="show_super"> 67 <property name="is_focus">True</property> 68 <property name="visible">True</property> 69 <child> 70 <widget class="GtkAlignment" id="alignment4"> 71 <property name="visible">True</property> 72 <child> 73 <widget class="GtkVBox" id="vbox1"> 74 <property name="visible">True</property> 75 <child> 76 <widget class="GtkImage" id="image1"> 77 <property name="file">source-extramethod.png</property> 78 <property name="visible">True</property> 79 </widget> 80 </child> 81 <child> 82 <widget class="GtkLabel" id="label1"> 83 <property name="label" context="yes" translatable="yes">Super</property> 84 <property name="visible">True</property> 85 </widget> 86 <packing> 87 <property name="position">1</property> 88 </packing> 89 </child> 90 </widget> 91 </child> 92 </widget> 93 </child> 94 </widget> 95 <packing> 96 <property name="expand">False</property> 97 <property name="position">1</property> 98 </packing> 99 </child> 100 <child> 101 <widget class="GtkCheckButton" id="show_builtins"> 102 <property name="visible">True</property> 103 <child> 104 <widget class="GtkAlignment" id="alignment31"> 105 <property name="visible">True</property> 106 <child> 107 <widget class="GtkVBox" id="vbox4"> 108 <property name="visible">True</property> 109 <child> 110 <widget class="GtkImage" id="image4"> 111 <property name="file">source-import.png</property> 112 <property name="visible">True</property> 113 </widget> 114 </child> 115 <child> 116 <widget class="GtkLabel" id="label13"> 117 <property name="label" context="yes" translatable="yes">Builtins</property> 118 <property name="visible">True</property> 119 </widget> 120 <packing> 121 <property name="position">1</property> 122 </packing> 123 </child> 124 </widget> 125 </child> 126 </widget> 127 </child> 128 </widget> 129 <packing> 130 <property name="position">2</property> 131 </packing> 132 </child> 133 </widget> 134 </child> 135 </widget> 136 <packing> 137 <property name="expand">False</property> 138 <property name="position">1</property> 139 </packing> 140 </child> 141 <child> 142 <placeholder/> 143 <packing> 144 <property name="position">2</property> 145 </packing> 146 </child> 147 </widget> 22 148 </child> 23 <child> 24 <placeholder/> 25 </child> 26 </widget> 27 </child> 28 </widget> 149 </widget> 29 150 </glade-interface> -
pida-plugins/python/python.py
r1202 r1212 171 171 #Column('ctype_markup', use_markup=True), 172 172 #Column('nodename_markup', use_markup=True), 173 Column('icon_name', use_stock=True), 174 Column('rendered', use_markup=True, expand=True), 173 175 Column('type_markup', use_markup=True), 174 Column('rendered', use_markup=True, expand=True),175 176 Column('sort_hack', visible=False), 176 177 Column('line_sort_hack', visible=False), … … 207 208 self.svc.boss.editor.cmd('grab_focus') 208 209 210 def on_show_super__toggled(self, but): 211 self.browser.refresh_view() 212 213 def on_show_builtins__toggled(self, but): 214 self.browser.refresh_view() 215 216 def on_show_imports__toggled(self, but): 217 self.browser.refresh_view() 218 219 209 220 210 221 from ropebrowser import ModuleParser … … 215 226 self.svc = svc 216 227 self._view = SourceView(self.svc) 228 # Naughty ali 229 self._view.browser = self 217 230 self.set_current_document(None) 218 231 … … 227 240 228 241 def refresh_view(self): 242 self.options = self.read_options() 229 243 self._view.clear_items() 230 244 if self.svc.is_current_python(): … … 241 255 242 256 def add_view_node(self, node, parent): 257 t = node.options.type_name 258 if t in self.options and not self.options[t]: 259 return 243 260 self._view.add_node(node, parent) 244 261 245 262 def get_view(self): 246 263 return self._view 264 265 def read_options(self): 266 return { 267 '(m)': self._view.show_super.get_active(), 268 '(b)': self._view.show_builtins.get_active(), 269 'imp': self._view.show_imports.get_active(), 270 } 247 271 248 272 -
pida-plugins/python/ropebrowser.py
r1200 r1212 63 63 position = 0 64 64 has_children = False 65 icon_name = 'source-property' 65 66 66 67 def __init__(self, treeitem): … … 80 81 81 82 type_name = 'f' 83 icon_name = 'source-function' 82 84 type_color = '#900000' 83 85 position = 2 … … 88 90 self.item.object.decorators]) 89 91 if decs: 92 print self.item.object.decorators 90 93 decs = decs + '\n' 91 94 return markup_fixed(markup_italic(decs)) … … 106 109 107 110 type_name = 'p' 111 icon_name = 'source-property' 108 112 type_color = '#900090' 109 113 … … 112 116 113 117 type_name = 'm' 118 icon_name = 'source-method' 114 119 115 120 … … 117 122 118 123 type_name = '(m)' 124 icon_name = 'source-extramethod' 119 125 position = 6 120 126 … … 122 128 123 129 type_name = 'cm' 130 icon_name = 'source-method' 124 131 position = 3 125 132 … … 127 134 128 135 type_name = 'sm' 136 icon_name = 'source-method' 129 137 position = 4 130 138 … … 134 142 135 143 type_name = 'c' 144 icon_name = 'source-class' 136 145 type_color = '#000090' 137 146 position = 1 … … 153 162 154 163 type_name = 'a' 164 icon_name = 'source-attribute' 155 165 type_color = '#009000' 156 166 position = 5 … … 159 169 160 170 type_name = '(b)' 171 icon_name = None 161 172 type_color = '#999999' 162 173 position = 7 … … 165 176 166 177 type_name = 'imp' 178 icon_name = 'source-import' 167 179 type_color = '#999999' 168 180 position = 8 181 icon_name = 'source-module' 169 182 170 183 def get_option_for_item(item): … … 233 246 self.options.type_color) 234 247 248 self.icon_name = self.options.icon_name 249 235 250 def render(self): 236 251 return '%s%s%s %s' % ( … … 258 273 yield name, node 259 274 260 def create_tree_items(self, name, node, parent=None ):275 def create_tree_items(self, name, node, parent=None, start=False): 261 276 ti = SourceTreeItem(self.mod, name, node, parent) 262 277 if ti: -
pida-plugins/python/test_python.py
r1014 r1212 22 22 23 23 24 def any_f(): 25 pass 26 27 def any_f2(a): 28 pass 29 30 @any_f2 31 def dec_f(a): 32 pass 33 34 dec_f = any_f2(dec_f) 35 24 36 25 37
