/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/__init__.py

  • Committer: Szilveszter Farkas (Phanatic)
  • Date: 2007-06-10 15:44:44 UTC
  • mto: This revision was merged to the branch mainline in revision 201.
  • Revision ID: szilveszter.farkas@gmail.com-20070610154444-7huju7ssvngyl9sf
Fixed some minor things and added file_id to the list model.

Show diffs side-by-side

added added

removed removed

Lines of Context:
245
245
            self.remote_branch, self.remote_path = Branch.open_containing(path)
246
246
            
247
247
            if self.remote_revision is None:
248
 
                self.remote_entries = self.remote_branch.repository.get_inventory(self.remote_branch.last_revision()).entries()
249
 
            else:
250
 
                self.remote_entries = self.remote_branch.repository.get_inventory(self.remote_revision).entries()
 
248
                self.remote_revision = self.remote_branch.last_revision()
 
249
            
 
250
            self.remote_entries = self.remote_branch.repository.get_inventory(self.remote_revision).entries()
251
251
            
252
252
            if len(self.remote_path) == 0:
253
253
                self.remote_parent = self.remote_branch.repository.get_inventory(self.remote_branch.last_revision()).iter_entries_by_dir().next()[1].file_id
312
312
                self.remote_branch, self.remote_path = Branch.open_containing(path)
313
313
                
314
314
                if self.remote_revision is None:
315
 
                    self.remote_entries = self.remote_branch.repository.get_inventory(self.remote_branch.last_revision()).entries()
316
 
                else:
317
 
                    self.remote_entries = self.remote_branch.repository.get_inventory(self.remote_revision).entries()
 
315
                    self.remote_revision = self.remote_branch.last_revision()
 
316
                
 
317
                self.remote_entries = self.remote_branch.repository.get_inventory(self.remote_revision).entries()
318
318
                
319
319
                if len(self.remote_path) == 0:
320
320
                    self.remote_parent = self.remote_branch.repository.get_inventory(self.remote_branch.last_revision()).iter_entries_by_dir().next()[1].file_id
408
408
            self.entry_history.set_sensitive(False)
409
409
            self.button_history.set_sensitive(False)
410
410
    
 
411
    @show_bzr_error
411
412
    def on_entry_history_revno_key_press_event(self, widget, event):
412
413
        """ Key pressed handler for the history entry. """
413
414
        if event.keyval == 65293:
838
839
    def _load_right(self):
839
840
        """ Load data into the right panel. (Filelist) """
840
841
        # Create ListStore
841
 
        # Model: [icon, dir, name, status text, status, size (int), size (human), mtime (int), mtime (local)]
842
 
        liststore = gtk.ListStore(str, gobject.TYPE_BOOLEAN, str, str, str, gobject.TYPE_INT, gobject.TYPE_STRING, gobject.TYPE_INT, gobject.TYPE_STRING)
 
842
        # Model: [ icon, dir, name, status text, status, size (int), size (human), mtime (int), mtime (local), fileid]
 
843
        liststore = gtk.ListStore(gobject.TYPE_STRING,
 
844
                                  gobject.TYPE_BOOLEAN,
 
845
                                  gobject.TYPE_STRING,
 
846
                                  gobject.TYPE_STRING,
 
847
                                  gobject.TYPE_STRING,
 
848
                                  gobject.TYPE_INT,
 
849
                                  gobject.TYPE_STRING,
 
850
                                  gobject.TYPE_INT,
 
851
                                  gobject.TYPE_STRING,
 
852
                                  gobject.TYPE_STRING)
843
853
        
844
854
        dirs = []
845
855
        files = []
863
873
        # Add'em to the ListStore
864
874
        for item in dirs:
865
875
            statinfo = os.stat(self.path + os.sep + item)
866
 
            liststore.append([gtk.STOCK_DIRECTORY, True, item, '', '', statinfo.st_size, self._format_size(statinfo.st_size), statinfo.st_mtime, self._format_date(statinfo.st_mtime)])
 
876
            liststore.append([ gtk.STOCK_DIRECTORY,
 
877
                               True,
 
878
                               item,
 
879
                               '',
 
880
                               '',
 
881
                               statinfo.st_size,
 
882
                               self._format_size(statinfo.st_size),
 
883
                               statinfo.st_mtime,
 
884
                               self._format_date(statinfo.st_mtime),
 
885
                               ''])
867
886
        for item in files:
868
887
            status = 'unknown'
 
888
            fileid = ''
869
889
            if not self.notbranch:
870
890
                filename = self.wt.relpath(self.path + os.sep + item)
871
891
                
875
895
                    for rpath, rpathnew, id, kind, text_modified, meta_modified in delta.renamed:
876
896
                        if rpathnew == filename:
877
897
                            status = 'renamed'
 
898
                            fileid = id
878
899
                    for rpath, id, kind in delta.added:
879
900
                        if rpath == filename:
880
901
                            status = 'added'
 
902
                            fileid = id
881
903
                    for rpath, id, kind in delta.removed:
882
904
                        if rpath == filename:
883
905
                            status = 'removed'
 
906
                            fileid = id
884
907
                    for rpath, id, kind, text_modified, meta_modified in delta.modified:
885
908
                        if rpath == filename:
886
909
                            status = 'modified'
 
910
                            fileid = id
887
911
                    for rpath, id, kind in delta.unchanged:
888
912
                        if rpath == filename:
889
913
                            status = 'unchanged'
 
914
                            fileid = id
890
915
                    for rpath, file_class, kind, id, entry in self.wt.list_files():
891
916
                        if rpath == filename and file_class == 'I':
892
917
                            status = 'ignored'
893
918
                finally:
894
919
                    self.wt.unlock()
895
920
            
896
 
            #try:
897
 
            #    status = fileops.status(path + os.sep + item)
898
 
            #except errors.PermissionDenied:
899
 
            #    continue
900
 
            
901
921
            if status == 'renamed':
902
922
                st = _('renamed')
903
923
            elif status == 'removed':
914
934
                st = _('unknown')
915
935
            
916
936
            statinfo = os.stat(self.path + os.sep + item)
917
 
            liststore.append([gtk.STOCK_FILE, False, item, st, status, statinfo.st_size, self._format_size(statinfo.st_size), statinfo.st_mtime, self._format_date(statinfo.st_mtime)])
 
937
            liststore.append([gtk.STOCK_FILE,
 
938
                              False,
 
939
                              item,
 
940
                              st,
 
941
                              status,
 
942
                              statinfo.st_size,
 
943
                              self._format_size(statinfo.st_size),
 
944
                              statinfo.st_mtime,
 
945
                              self._format_date(statinfo.st_mtime),
 
946
                              fileid])
918
947
        
919
948
        # Create the columns and add them to the TreeView
920
949
        self.treeview_right.set_model(liststore)
960
989
        # Set sensitivity
961
990
        self.set_sensitivity()
962
991
        
 
992
    def get_selected_fileid(self):
 
993
        """ Get the file_id of the selected file. """
 
994
        treeselection = self.treeview_right.get_selection()
 
995
        (model, iter) = treeselection.get_selected()
 
996
        
 
997
        if iter is None:
 
998
            return None
 
999
        else:
 
1000
            return model.get_value(iter, 9)
 
1001
    
963
1002
    def get_selected_right(self):
964
1003
        """ Get the selected filename. """
965
1004
        treeselection = self.treeview_right.get_selection()
1121
1160
            # Add'em to the ListStore
1122
1161
            for item in dirs:
1123
1162
                statinfo = os.stat(self.path + os.sep + item)
1124
 
                liststore.append([gtk.STOCK_DIRECTORY, True, item, '', '', statinfo.st_size, self._format_size(statinfo.st_size), statinfo.st_mtime, self._format_date(statinfo.st_mtime)])
 
1163
                liststore.append([gtk.STOCK_DIRECTORY,
 
1164
                                  True,
 
1165
                                  item,
 
1166
                                  '',
 
1167
                                  '',
 
1168
                                  statinfo.st_size,
 
1169
                                  self._format_size(statinfo.st_size),
 
1170
                                  statinfo.st_mtime,
 
1171
                                  self._format_date(statinfo.st_mtime),
 
1172
                                  ''])
1125
1173
            for item in files:
1126
1174
                status = 'unknown'
 
1175
                fileid = ''
1127
1176
                if not notbranch:
1128
1177
                    filename = tree1.relpath(path + os.sep + item)
1129
1178
                    
1133
1182
                        for rpath, rpathnew, id, kind, text_modified, meta_modified in delta.renamed:
1134
1183
                            if rpathnew == filename:
1135
1184
                                status = 'renamed'
 
1185
                                fileid = id
1136
1186
                        for rpath, id, kind in delta.added:
1137
1187
                            if rpath == filename:
1138
 
                                status = 'added'                
 
1188
                                status = 'added'
 
1189
                                fileid = id
1139
1190
                        for rpath, id, kind in delta.removed:
1140
1191
                            if rpath == filename:
1141
1192
                                status = 'removed'
 
1193
                                fileid = id
1142
1194
                        for rpath, id, kind, text_modified, meta_modified in delta.modified:
1143
1195
                            if rpath == filename:
1144
1196
                                status = 'modified'
 
1197
                                fileid = id
1145
1198
                        for rpath, id, kind in delta.unchanged:
1146
1199
                            if rpath == filename:
1147
1200
                                status = 'unchanged'
 
1201
                                fileid = id
1148
1202
                        for rpath, file_class, kind, id, entry in self.wt.list_files():
1149
1203
                            if rpath == filename and file_class == 'I':
1150
1204
                                status = 'ignored'
1167
1221
                    st = _('unknown')
1168
1222
                
1169
1223
                statinfo = os.stat(self.path + os.sep + item)
1170
 
                liststore.append([gtk.STOCK_FILE, False, item, st, status, statinfo.st_size, self._format_size(statinfo.st_size), statinfo.st_mtime, self._format_date(statinfo.st_mtime)])
 
1224
                liststore.append([gtk.STOCK_FILE,
 
1225
                                  False,
 
1226
                                  item,
 
1227
                                  st,
 
1228
                                  status,
 
1229
                                  statinfo.st_size,
 
1230
                                  self._format_size(statinfo.st_size),
 
1231
                                  statinfo.st_mtime,
 
1232
                                  self._format_date(statinfo.st_mtime),
 
1233
                                  fileid])
1171
1234
        else:
1172
1235
            # We're remote
1173
1236
            
1223
1286
                                       0,
1224
1287
                                       self._format_size(0),
1225
1288
                                       rev.timestamp,
1226
 
                                       self._format_date(rev.timestamp)
 
1289
                                       self._format_date(rev.timestamp),
 
1290
                                       ''
1227
1291
                                   ])
1228
1292
                while gtk.events_pending():
1229
1293
                    gtk.main_iteration()
1239
1303
                                       item.text_size,
1240
1304
                                       self._format_size(item.text_size),
1241
1305
                                       rev.timestamp,
1242
 
                                       self._format_date(rev.timestamp)
 
1306
                                       self._format_date(rev.timestamp),
 
1307
                                       item.file_id
1243
1308
                                   ])
1244
1309
                while gtk.events_pending():
1245
1310
                    gtk.main_iteration()