Sha256: 34f223266cdbe9e38b72ae81ba9a673d9bcf2d9e60434cc7079e5b0fcad46128
Contents?: true
Size: 1.85 KB
Versions: 6
Compression:
Stored size: 1.85 KB
Contents
# # This class contains the applicatio and map's settings # class FXMapperSettings < Hash def home if ENV['HOME'] homedir = File.expand_path('~') # Ahh... you have to love windows... elsif ENV['USERPROFILE'] homedir = ENV['USERPROFILE'] elsif ENV['HOMEDRIVE'] and ENV['HOMEPATH'] homedir = ENV['HOMEDRIVE'] + ENV['HOMEPATH'] else homedir = '.' end return homedir end def write begin file = home + '/.ifmapper' f = File.open(file, 'w') f.puts YAML.dump(self) f.close rescue => e $stderr.puts "Preferences not saved:" $stderr.puts e end end def initialize begin f = home + '/.ifmapper' self.replace( YAML.load_file(f) ) rescue end defaults = { # Colors 'BG Color' => 'dark grey', 'Arrow Color' => 'black', 'Box BG Color' => 'white', 'Box Darkness Color' => 'grey', 'Box Border Color' => 'black', 'Box Number Color' => 'grey', # Fonts 'Font Text' => 'Times', 'Font Objects' => 'Times', # Creation options 'Create on Connection' => true, 'Edit on Creation' => false, 'Automatic Connection' => true, # Display options 'Use Room Cursor' => false, 'Paths as Curves' => true, # Location options 'Location Tasks' => true, 'Location Description' => false, 'Location Numbers' => true, # Grid options 'Grid Boxes' => true, 'Grid Straight Connections' => true, 'Grid Diagonal Connections' => false, } self.replace( defaults.merge(self) ) end end
Version data entries
6 entries across 6 versions & 1 rubygems