Commits

Erik Grinaker  committed dc75ad0

set up entry data during class instantiation, so we can set up gettext before the texts are created

  • Participants
  • Parent commits 7c785d3

Comments (0)

Files changed (4)

File src/lib/datahandler/rvl.py

 		"Looks up an entry type based on an identifier"
 
 		for entrytype in entry.ENTRYLIST:
-			if entrytype.id == typename:
+			if entrytype().id == typename:
 				return entrytype
 
 		else:

File src/lib/datahandler/xhtml.py

 			if not entries.has_key(entrytype):
 				continue
 
-			xhtml += "	<h3>%s:</h3>\n" % entrytype.typename
+			xhtml += "	<h3>%s:</h3>\n" % entrytype().typename
 			xhtml += "\n"
 			xhtml += "	<ul class=\"accountlist\">\n"
 

File src/lib/entry.py

 
 class FolderEntry(Entry):
 
-	id		= "folder"
-	typename	= _('Folder')
-	icon		= ui.STOCK_ENTRY_FOLDER
-	openicon	= ui.STOCK_ENTRY_FOLDER_OPEN
+	def __init__(self):
+		Entry.__init__(self)
+
+		self.id		= "folder"
+		self.typename	= _('Folder')
+		self.icon	= ui.STOCK_ENTRY_FOLDER
+		self.openicon	= ui.STOCK_ENTRY_FOLDER_OPEN
+
+
+
+class CreditcardEntry(Entry):
 
 	def __init__(self):
 		Entry.__init__(self)
 
-
-
-class CreditcardEntry(Entry):
-
-	id		= "creditcard"
-	typename	= _('Creditcard')
-	icon		= ui.STOCK_ENTRY_CREDITCARD
-
-	def __init__(self):
-		Entry.__init__(self)
+		self.id		= "creditcard"
+		self.typename	= _('Creditcard')
+		self.icon	= ui.STOCK_ENTRY_CREDITCARD
 
 		self.fields = [
 			CardtypeField(),
 
 class CryptoKeyEntry(Entry):
 
-	id		= "cryptokey"
-	typename	= _('Crypto Key')
-	icon		= ui.STOCK_ENTRY_CRYPTOKEY
-
 	def __init__(self):
 		Entry.__init__(self)
 
+		self.id		= "cryptokey"
+		self.typename	= _('Crypto Key')
+		self.icon	= ui.STOCK_ENTRY_CRYPTOKEY
+
 		self.fields = [
 			HostnameField(),
 			CertificateField(),
 
 class DatabaseEntry(Entry):
 
-	id		= "database"
-	typename	= _('Database')
-	icon		= ui.STOCK_ENTRY_DATABASE
-
 	def __init__(self):
 		Entry.__init__(self)
 
+		self.id		= "database"
+		self.typename	= _('Database')
+		self.icon	= ui.STOCK_ENTRY_DATABASE
+
 		self.fields = [
 			HostnameField(),
 			UsernameField(),
 
 class DoorEntry(Entry):
 
-	id		= "door"
-	typename	= _('Door lock')
-	icon		= ui.STOCK_ENTRY_DOOR
-
 	def __init__(self):
 		Entry.__init__(self)
 
+		self.id		= "door"
+		self.typename	= _('Door lock')
+		self.icon	= ui.STOCK_ENTRY_DOOR
+
 		self.fields = [
 			LocationField(),
 			CodeField()
 
 class EmailEntry(Entry):
 
-	id		= "email"
-	typename	= _('Email')
-	icon		= ui.STOCK_ENTRY_EMAIL
-
 	def __init__(self):
 		Entry.__init__(self)
 
+		self.id		= "email"
+		self.typename	= _('Email')
+		self.icon	= ui.STOCK_ENTRY_EMAIL
+
 		self.fields = [
 			EmailField(),
 			HostnameField(),
 
 class FTPEntry(Entry):
 
-	id		= "ftp"
-	typename	= _('FTP')
-	icon		= ui.STOCK_ENTRY_FTP
-
 	def __init__(self):
 		Entry.__init__(self)
 
+		self.id		= "ftp"
+		self.typename	= _('FTP')
+		self.icon	= ui.STOCK_ENTRY_FTP
+
 		self.fields = [
 			HostnameField(),
 			PortField(),
 
 class GenericEntry(Entry):
 
-	id		= "generic"
-	typename	= _('Generic')
-	icon		= ui.STOCK_ENTRY_GENERIC
-
 	def __init__(self):
 		Entry.__init__(self)
 
+		self.id		= "generic"
+		self.typename	= _('Generic')
+		self.icon	= ui.STOCK_ENTRY_GENERIC
+
 		self.fields = [
 			HostnameField(),
 			UsernameField(),
 
 class PhoneEntry(Entry):
 
-	id		= "phone"
-	typename	= _('Phone')
-	icon		= ui.STOCK_ENTRY_PHONE
-
 	def __init__(self):
 		Entry.__init__(self)
 
+		self.id		= "phone"
+		self.typename	= _('Phone')
+		self.icon	= ui.STOCK_ENTRY_PHONE
+
 		self.fields = [
 			PhonenumberField(),
 			PINField()
 
 class ShellEntry(Entry):
 
-	id		= "shell"
-	typename	= _('Shell')
-	icon		= ui.STOCK_ENTRY_SHELL
-
 	def __init__(self):
 		Entry.__init__(self)
 
+		self.id		= "shell"
+		self.typename	= _('Shell')
+		self.icon	= ui.STOCK_ENTRY_SHELL
+
 		self.fields = [
 			HostnameField(),
 			DomainField(),
 
 class WebEntry(Entry):
 
-	id		= "website"
-	typename	= _('Website')
-	icon		= ui.STOCK_ENTRY_WEBSITE
-
 	def __init__(self):
 		Entry.__init__(self)
 
+		self.id		= "website"
+		self.typename	= _('Website')
+		self.icon	= ui.STOCK_ENTRY_WEBSITE
+
 		self.fields = [
 			URLField(),
 			UsernameField(),

File src/lib/ui.py

 
 		for e in entry.ENTRYLIST:
 			if e != entry.FolderEntry:
-				self.append_item(e.typename, e.icon, e)
+				self.append_item(e().typename, e().icon, e)
 
 
 	def get_active_type(self):