/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to olive/frontend/gtk/__init__.py

  • Committer: Szilveszter Farkas (Phanatic)
  • Date: 2006-07-20 14:31:08 UTC
  • mto: (0.14.1 main) (93.1.1 win32.bialix)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: Szilveszter.Farkas@gmail.com-20060720143108-12c16a5c52431578
2006-07-20  Szilveszter Farkas <Szilveszter.Farkas@gmail.com>

    * olive/frontend/gtk/__init__.py: implemented OliveCommunication.refresh_right()
    * olive/frontend/gtk/handler.py: implemented browsing in the file list
    * olive/backend/fileops.py: tweaked status() (to get proper status in fact)

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
                "on_about_activate": handler.on_about_activate,
60
60
                "on_menuitem_file_make_directory_activate": handler.not_implemented,
61
61
                "on_menuitem_branch_branch_activate": handler.on_menuitem_branch_branch_activate,
62
 
                "on_menuitem_branch_commit_activate": handler.not_implemented }
 
62
                "on_menuitem_branch_commit_activate": handler.not_implemented,
 
63
                "on_treeview_right_row_activated": handler.on_treeview_right_row_activated }
63
64
        
64
65
        # Connect the signals to the handlers
65
66
        self.toplevel.signal_autoconnect(dic)
81
82
        # Create ListStore
82
83
        liststore = gtk.ListStore(str, str, str)
83
84
        
84
 
        dirs = []
 
85
        dirs = ['..']
85
86
        files = []
86
87
        
87
88
        # Fill the appropriate lists
88
 
        for item in os.listdir(self.comm.get_path()):
89
 
            if os.path.isdir(item):
 
89
        path = self.comm.get_path()
 
90
        for item in os.listdir(path):
 
91
            if os.path.isdir(path + '/' + item):
90
92
                dirs.append(item)
91
93
            else:
92
94
                files.append(item)
99
101
        for item in dirs:    
100
102
            liststore.append([gtk.STOCK_DIRECTORY, item, ''])
101
103
        for item in files:
102
 
            liststore.append([gtk.STOCK_FILE, item, fileops.status(item)])
 
104
            liststore.append([gtk.STOCK_FILE, item, fileops.status(path + '/' + item)])
103
105
        
104
106
        # Create the columns and add them to the TreeView
105
107
        self.treeview_right.set_model(liststore)
130
132
        # Initialize the statusbar
131
133
        self.statusbar = self.toplevel.get_widget('statusbar')
132
134
        self.context_id = self.statusbar.get_context_id('olive')
 
135
        
 
136
        # Get the TreeViews
 
137
        self.treeview_left = self.toplevel.get_widget('treeview_left')
 
138
        self.treeview_right = self.toplevel.get_widget('treeview_right')
133
139
    
134
140
    def set_path(self, path):
135
141
        """ Set the current path while browsing the directories. """
147
153
        """ Clean the last message from the statusbar. """
148
154
        self.statusbar.pop(self.context_id)
149
155
    
150
 
    def refresh_right(self):
 
156
    def refresh_right(self, path=None):
151
157
        """ Refresh the file list. """
152
 
        pass
 
158
        import olive.backend.fileops as fileops
 
159
 
 
160
        if path is None:
 
161
            path = self.get_path()
 
162
 
 
163
        # Get ListStore and clear it
 
164
        liststore = self.treeview_right.get_model()
 
165
        liststore.clear()
 
166
        
 
167
        dirs = ['..']
 
168
        files = []
 
169
        
 
170
        # Fill the appropriate lists
 
171
        for item in os.listdir(path):
 
172
            if os.path.isdir(path + '/' + item):
 
173
                dirs.append(item)
 
174
            else:
 
175
                files.append(item)
 
176
            
 
177
        # Sort'em
 
178
        dirs.sort()
 
179
        files.sort()
 
180
        
 
181
        # Add'em to the ListStore
 
182
        for item in dirs:    
 
183
            liststore.append([gtk.STOCK_DIRECTORY, item, ''])
 
184
        for item in files:
 
185
            liststore.append([gtk.STOCK_FILE, item, fileops.status(path + '/' + item)])
 
186
        
 
187
        # Add the ListStore to the TreeView
 
188
        self.treeview_right.set_model(liststore)