Changeset 1324
- Timestamp:
- 05/11/08 08:43:26 (4 months ago)
- Files:
-
- wine-doors/branches/0.2/src/bottles/__init__.py (modified) (2 diffs)
- wine-doors/branches/0.2/src/preferences.py (modified) (8 diffs)
- wine-doors/branches/0.2/src/registry.py (moved) (moved from wine-doors/branches/0.2/src/engines/registry.py)
- wine-doors/branches/0.2/testing/bottles.xml (added)
- wine-doors/branches/0.2/testing/preferences.xml (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
wine-doors/branches/0.2/src/bottles/__init__.py
r1286 r1324 1 from const import * 1 2 2 3 class ParseBottles: 3 pass4 5 class Bottle:6 4 pass 7 5 … … 18 16 def CreateBottle( self ): 19 17 pass 18 19 20 21 class default: 22 pass 23 # TODO: Ripped from old preferences.py 24 # f.write( " <bottles>\n" ) 25 # for name, path, icon in self.bottles: 26 # f.write( " <bottle name=\"%s\" path=\"%s\" icon=\"%s\" />\n" % ( name, path, icon ) ) 27 # f.write( " </bottles>\n" ) 28 29 # endelement 30 # elif name == "bottle" and self.in_bottles: 31 # self.bottles.append ( [self.bottle_name, self.bottle_path, self.bottle_icon] ) 32 # start element 33 # elif name == "bottle" and self.in_bottles: 34 # self.bottle_name = attrs.get( 'name' ) 35 # self.bottle_name = self.bottle_name.rstrip() 36 # self.bottle_path = attrs.get( 'path' ) 37 # self.bottle_path = self.bottle_path.rstrip() 38 # self.bottle_icon = attrs.get( 'icon' ) 39 # self.bottle_icon = self.bottle_icon.rstrip() 40 wine-doors/branches/0.2/src/preferences.py
r1323 r1324 26 26 27 27 def startElement( self, name, attrs ): 28 if name == " winedoors-prefernces":28 if name == "prefernces": 29 29 self.in_conf_file = True 30 30 elif name == "repositories" and self.in_conf_file: … … 45 45 self.repo_password = attrs.get( 'password' ) 46 46 self.repo_password = self.repo_password.rstrip() 47 elif name == "bottle" and self.in_bottles:48 self.bottle_name = attrs.get( 'name' )49 self.bottle_name = self.bottle_name.rstrip()50 51 self.bottle_path = attrs.get( 'path' )52 self.bottle_path = self.bottle_path.rstrip()53 54 self.bottle_icon = attrs.get( 'icon' )55 self.bottle_icon = self.bottle_icon.rstrip()56 47 57 48 def characters ( self, string ): … … 59 50 60 51 def endElement( self, name ): 61 if name == " winedoors-preferences":52 if name == "preferences": 62 53 self.in_conf_file = False 63 54 elif name == "repositories" and self.in_conf_file: 64 55 self.in_repo_list = False 65 elif name == "bottles" and self.in_conf_file:66 self.in_bottles = False67 56 elif name == "repo" and self.in_repo_list: 68 57 self.repositories.append( [self.repo_name, self.repo_uri, 69 58 self.repo_username, self.repo_password] ) 70 elif name == "bottle" and self.in_bottles:71 self.bottles.append ( [self.bottle_name, self.bottle_path, self.bottle_icon] )72 59 elif self.in_conf_file: 73 60 text = ''.join( self.data ) … … 91 78 preferences_file = "/etc/wine-doors/preferences.xml" 92 79 if not os.path.isfile( preferences_file ): 93 os. popen( "mkdir" + os.path.expanduser( "~/.wine-doors" ) )80 os.system( "mkdir -p " + os.path.expanduser( "~/.wine-doors" ) ) 94 81 self.preferences_file = os.path.expanduser( "~/.wine-doors/preferences.xml" ) 95 82 self.Default() … … 116 103 117 104 def DefaultRepos ( self ): 118 preferences.AddRepo ( "Applications", "http://www.wine-doors.org/repositories/applications.repo/" )119 preferences.AddRepo ( "System Base", "http://www.wine-doors.org/repositories/base.repo/" )120 preferences.AddRepo ( "Games", "http://www.wine-doors.org/repositories/games.repo/" )121 preferences.AddRepo ( "Libraries and Fonts", "http://www.wine-doors.org/repositories/libraries.repo/" )105 preferences.AddRepository( "Applications", "http://www.wine-doors.org/repositories/applications.repo/" ) 106 preferences.AddRepository( "System Base", "http://www.wine-doors.org/repositories/base.repo/" ) 107 preferences.AddRepository( "Games", "http://www.wine-doors.org/repositories/games.repo/" ) 108 preferences.AddRepository( "Libraries and Fonts", "http://www.wine-doors.org/repositories/libraries.repo/" ) 122 109 123 def AddRepo ( self, name, uri, username=None, password=None ):110 def AddRepository( self, name, uri, username=None, password=None ): 124 111 for item in self.repositories: 125 112 if ''.join( item[0:1] ) == name: … … 130 117 131 118 # TODO 132 def DelRepo( self, name ): 133 pass 134 def AddBottle ( self, name, path, icon ): 135 pass 136 def DelBottle ( self, name ): 119 def DelRepository( self, name ): 137 120 pass 138 121 … … 167 150 168 151 f = open( preferences_file, "wt" ) 169 f.write( "<winedoors-preferences>\n" ) 152 f.write( "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" ) 153 f.write( "<!--DOCTYPE WineDoorsPreferences SYSTEM \"http://www.wine-doors.org/dtd/preferences.dtd\"-->\n" ) 154 f.write( "<preferences>\n" ) 170 155 171 156 for key, value in self.preferences.iteritems(): … … 181 166 f.write( " </repositories>\n" ) 182 167 183 f.write( " <bottles>\n" ) 184 for name, path, icon in self.bottles: 185 f.write( " <bottle name=\"%s\" path=\"%s\" icon=\"%s\" />\n" % ( name, path, icon ) ) 186 f.write( " </bottles>\n" ) 187 188 f.write( "</winedoors-preferences>\n" ) 168 f.write( "</preferences>\n" ) 189 169 f.close() 190 170
