Changeset 1212:7c90fe5ca475

Show
Ignore:
Timestamp:
07/25/08 16:16:49 (4 months ago)
Author:
Ali Afshar <aafshar@…>
Message:

use images for python browser types

Location:
pida-plugins/python
Files:
9 added
4 modified

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"> 
    43<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"> 
    105        <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> 
    136        <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> 
    22148        </child> 
    23         <child> 
    24           <placeholder/> 
    25         </child> 
    26       </widget> 
    27     </child> 
    28   </widget> 
     149    </widget> 
    29150</glade-interface> 
  • pida-plugins/python/python.py

    r1202 r1212  
    171171                #Column('ctype_markup', use_markup=True), 
    172172                #Column('nodename_markup', use_markup=True), 
     173                Column('icon_name', use_stock=True), 
     174                Column('rendered', use_markup=True, expand=True), 
    173175                Column('type_markup', use_markup=True), 
    174                 Column('rendered', use_markup=True, expand=True), 
    175176                Column('sort_hack', visible=False), 
    176177                Column('line_sort_hack', visible=False), 
     
    207208        self.svc.boss.editor.cmd('grab_focus') 
    208209 
     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 
    209220 
    210221from ropebrowser import ModuleParser 
     
    215226        self.svc = svc 
    216227        self._view = SourceView(self.svc) 
     228        # Naughty ali 
     229        self._view.browser = self 
    217230        self.set_current_document(None) 
    218231 
     
    227240 
    228241    def refresh_view(self): 
     242        self.options = self.read_options() 
    229243        self._view.clear_items() 
    230244        if self.svc.is_current_python(): 
     
    241255 
    242256    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 
    243260        self._view.add_node(node, parent) 
    244261 
    245262    def get_view(self): 
    246263        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        } 
    247271 
    248272 
  • pida-plugins/python/ropebrowser.py

    r1200 r1212  
    6363    position = 0 
    6464    has_children = False 
     65    icon_name = 'source-property' 
    6566 
    6667    def __init__(self, treeitem): 
     
    8081 
    8182    type_name = 'f' 
     83    icon_name = 'source-function' 
    8284    type_color = '#900000' 
    8385    position = 2 
     
    8890            self.item.object.decorators]) 
    8991        if decs: 
     92            print self.item.object.decorators 
    9093            decs = decs + '\n' 
    9194        return markup_fixed(markup_italic(decs)) 
     
    106109 
    107110    type_name = 'p' 
     111    icon_name = 'source-property' 
    108112    type_color = '#900090' 
    109113 
     
    112116 
    113117    type_name = 'm' 
     118    icon_name = 'source-method' 
    114119 
    115120 
     
    117122 
    118123    type_name = '(m)' 
     124    icon_name = 'source-extramethod' 
    119125    position = 6 
    120126 
     
    122128 
    123129    type_name = 'cm' 
     130    icon_name = 'source-method' 
    124131    position = 3 
    125132 
     
    127134 
    128135    type_name = 'sm' 
     136    icon_name = 'source-method' 
    129137    position = 4 
    130138 
     
    134142 
    135143    type_name = 'c' 
     144    icon_name = 'source-class' 
    136145    type_color = '#000090' 
    137146    position = 1 
     
    153162 
    154163    type_name = 'a' 
     164    icon_name = 'source-attribute' 
    155165    type_color = '#009000' 
    156166    position = 5 
     
    159169 
    160170    type_name = '(b)' 
     171    icon_name = None 
    161172    type_color = '#999999' 
    162173    position = 7 
     
    165176 
    166177    type_name = 'imp' 
     178    icon_name = 'source-import' 
    167179    type_color = '#999999' 
    168180    position = 8 
     181    icon_name = 'source-module' 
    169182 
    170183def get_option_for_item(item): 
     
    233246                                       self.options.type_color) 
    234247 
     248        self.icon_name = self.options.icon_name 
     249 
    235250    def render(self): 
    236251        return '%s%s%s %s' % ( 
     
    258273                yield name, node 
    259274 
    260     def create_tree_items(self, name, node, parent=None): 
     275    def create_tree_items(self, name, node, parent=None, start=False): 
    261276        ti = SourceTreeItem(self.mod, name, node, parent) 
    262277        if ti: 
  • pida-plugins/python/test_python.py

    r1014 r1212  
    2222 
    2323 
     24def any_f(): 
     25    pass 
     26 
     27def any_f2(a): 
     28    pass 
     29 
     30@any_f2 
     31def dec_f(a): 
     32    pass 
     33 
     34dec_f = any_f2(dec_f) 
     35 
    2436 
    2537