root/gaphor/tags/gaphor-0.12.0/gaphor/ui/accelmap.py

Revision 1240, 0.9 kB (checked in by arj..@yirdis.nl, 2 years ago)

--

Line 
1 """
2 This module contains user interface related code, such as the
3 main screen and diagram windows.
4 """
5
6 import os, os.path
7 import gtk
8
9 if os.name == 'nt':
10     home = 'USERPROFILE'
11 else:
12     home = 'HOME'
13
14 user_data_dir = os.path.join(os.getenv(home), '.gaphor')
15
16
17 def _get_accel_map_filename():
18     """
19     The Gaphor accelMap file ($HOME/.gaphor/accelmap).
20     """
21     if not os.path.exists(user_data_dir):
22         os.mkdir(user_data_dir)
23     return os.path.join(user_data_dir, 'accelmap')
24
25
26 def load_accel_map():
27     """
28     Load the user accelerator map from the gaphor user home directory
29     """
30     filename = _get_accel_map_filename()
31     if os.path.exists(filename) and os.path.isfile(filename):
32         gtk.accel_map_load(filename)
33
34
35 def save_accel_map():
36     """
37     Save the contents of the GtkAccelMap to a file.
38     """
39     filename = _get_accel_map_filename()
40     gtk.accel_map_save(filename)   
41
42
43 # vim:sw=4:et:
Note: See TracBrowser for help on using the browser.