~ubuntu-branches/ubuntu/trusty/mirage/trusty

« back to all changes in this revision

Viewing changes to mirage.py

  • Committer: Luke Faraone
  • Date: 2010-03-16 03:23:44 UTC
  • mfrom: (5.1.3 sid)
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: luke@faraone.cc-20100316032344-edvjm2ua6c8di21n
Merge version 0.9.3-5 from Debian Unstable.

* Fix dh_pysupport call, so only python-support controlled files are
  installed (Closes: #566038)
* Fix half-selected images (Closes: #536285). Thanks to Evgeni Golov patch
* Provide a mirage menu item (Closes: #550023)
* Add XDG base directory specification support (Closes: #535816). 
  Thanks to Jakub Wilk <ubanus@users.sf.net> patch
* Add suggest gimp, imagemagick, menu (Closes: #535822)
* By default, Ctrl+E is bound to the gimp-remote-2.4 command, which is no 
  longer available in sid (Closes: #535817)
  Thanks to Jakub Wilk <ubanus@users.sf.net> patch
* Switch to dpkg-source 3.0 (quilt) format
* Bump Standards-Version to 3.8.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
if gtk.pygtk_version < (2, 6, 0):
54
54
        sys.stderr.write("Mirage requires PyGTK 2.6.0 or newer.\n")
55
55
        sys.exit(1)
 
56
 
 
57
config_dir = (os.getenv('XDG_CONFIG_HOME') or os.path.expanduser('~/.config')) + '/mirage'
56
58
        
57
59
def valid_int(inputstring):
58
60
        try:
150
152
                self.preloading_images = True
151
153
                self.action_names = ["Open in GIMP", "Create Thumbnail", "Create Thumbnails", "Move to Favorites"]
152
154
                self.action_shortcuts = ["<Control>e", "<Alt>t", "<Control><Alt>t", "<Control><Alt>f"]
153
 
                self.action_commands = ["gimp-remote-2.4 %F", "convert %F -thumbnail 150x150 %Pt_%N.jpg", "convert %F -thumbnail 150x150 %Pt_%N.jpg", "mkdir -p ~/mirage-favs; mv %F ~/mirage-favs; [NEXT]"]
 
155
                self.action_commands = ["gimp %F &", "convert %F -thumbnail 150x150 %Pt_%N.jpg", "convert %F -thumbnail 150x150 %Pt_%N.jpg", "mkdir -p ~/mirage-favs; mv %F ~/mirage-favs; [NEXT]"]
154
156
                self.action_batch = [False, False, True, False]
155
157
                self.onload_cmd = None
156
158
                self.searching_for_images = False
204
206
 
205
207
                # Load config from disk:
206
208
                conf = ConfigParser.ConfigParser()
207
 
                if os.path.isfile(os.path.expanduser('~/.config/mirage/miragerc')):
208
 
                        conf.read(os.path.expanduser('~/.config/mirage/miragerc'))
 
209
                if os.path.isfile(config_dir + '/miragerc'):
 
210
                        conf.read(config_dir + '/miragerc')
209
211
                elif os.path.isfile(os.path.expanduser('~/.miragerc')):
210
212
                        conf.read(os.path.expanduser('~/.miragerc'))
211
213
                        os.remove(os.path.expanduser('~/.miragerc'))
297
299
                self.curr_slideshow_random = self.slideshow_random
298
300
 
299
301
                # Read accel_map file, if it exists
300
 
                if os.path.isfile(os.path.expanduser('~/.config/mirage/accel_map')):
301
 
                        gtk.accel_map_load(os.path.expanduser('~/.config/mirage/accel_map'))
 
302
                if os.path.isfile(config_dir + '/accel_map'):
 
303
                        gtk.accel_map_load(config_dir + '/accel_map')
302
304
                        
303
305
                self.blank_image = gtk.gdk.pixbuf_new_from_file(self.find_path("mirage_blank.png"))
304
306
 
1465
1467
                for i in range(len(self.recentfiles)):
1466
1468
                        conf.set('recent', 'num[' + str(i) + ']', len(self.recentfiles[i]))
1467
1469
                        conf.set('recent', 'urls[' + str(i) + ',0]', self.recentfiles[i])
1468
 
                if not os.path.exists(os.path.expanduser('~/.config/')):
1469
 
                        os.mkdir(os.path.expanduser('~/.config/'))
1470
 
                if not os.path.exists(os.path.expanduser('~/.config/mirage/')):
1471
 
                        os.mkdir(os.path.expanduser('~/.config/mirage/'))
1472
 
                conf.write(file(os.path.expanduser('~/.config/mirage/miragerc'), 'w'))
 
1470
                if not os.path.exists(config_dir):
 
1471
                        os.makedirs(config_dir)
 
1472
                conf.write(file(config_dir + '/miragerc', 'w'))
1473
1473
 
1474
1474
                # Also, save accel_map:
1475
 
                gtk.accel_map_save(os.path.expanduser('~/.config/mirage/accel_map'))
1476
 
 
 
1475
                gtk.accel_map_save(config_dir + '/accel_map')
1477
1476
                return
1478
1477
 
1479
1478
        def delete_event(self, widget, event, data=None):
3892
3891
                                self.last_image_action_was_smart_fit = False
3893
3892
                        elif self.open_mode == self.open_mode_1to1 or (self.open_mode == self.open_mode_last and self.last_mode == self.open_mode_1to1):
3894
3893
                                self.last_image_action_was_fit = False
 
3894
                        self.currimg_name = str(self.image_list[self.curr_img_in_list])
3895
3895
                else:
3896
3896
                        # Need to load the current image
3897
3897
                        self.currimg_pixbuf = None