--- a/objdictgen/gen_cfile.py Fri Aug 22 14:17:31 2008 +0200
+++ b/objdictgen/gen_cfile.py Thu Aug 28 14:24:22 2008 +0200
@@ -183,7 +183,7 @@
strIndex += "\n/* index 0x%(index)04X : %(EntryName)s. */\n"%texts
# Entry type is VAR
- if type(values) != ListType:
+ if isinstance(values, ListType):
subentry_infos = Node.GetSubentryInfos(index, 0)
typename = Node.GetTypeName(subentry_infos["type"])
typeinfos = GetValidTypeInfos(typename, [values])
--- a/objdictgen/networkedit.py Fri Aug 22 14:17:31 2008 +0200
+++ b/objdictgen/networkedit.py Thu Aug 28 14:24:22 2008 +0200
@@ -705,13 +705,13 @@
find_index = True
index, subIndex = result
result = OpenPDFDocIndex(index, ScriptDirectory)
- if type(result) == StringType:
+ if isinstance(result, (StringType, UnicodeType)):
message = wx.MessageDialog(self, result, "ERROR", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
if not find_index:
result = OpenPDFDocIndex(None, ScriptDirectory)
- if type(result) == StringType:
+ if isinstance(result, (StringType, UnicodeType)):
message = wx.MessageDialog(self, result, "ERROR", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
@@ -817,7 +817,7 @@
if dialog.ShowModal() == wx.ID_OK:
index, name, struct, number = dialog.GetValues()
result = self.Manager.AddMapVariableToCurrent(index, name, struct, number)
- if type(result) != StringType:
+ if not isinstance(result, (StringType, UnicodeType)):
self.RefreshBufferState()
self.RefreshCurrentIndexList()
else:
--- a/objdictgen/nodemanager.py Fri Aug 22 14:17:31 2008 +0200
+++ b/objdictgen/nodemanager.py Thu Aug 28 14:24:22 2008 +0200
@@ -1027,7 +1027,7 @@
editors = []
values = node.GetEntry(index, compute = False)
params = node.GetParamsEntry(index)
- if type(values) == ListType:
+ if isinstance(values, ListType):
for i, value in enumerate(values):
data.append({"value" : value})
data[-1].update(params[i])
@@ -1042,7 +1042,7 @@
dic["access"] = AccessType[infos["access"]]
dic["save"] = OptionType[dic["save"]]
editor = {"subindex" : None, "save" : "option", "callback" : "option", "comment" : "string"}
- if type(values) == ListType and i == 0:
+ if isinstance(values, ListType) and i == 0:
editor["name"] = None
editor["type"] = None
if 0x1600 <= index <= 0x17FF or 0x1A00 <= index <= 0x1C00:
--- a/objdictgen/objdictedit.py Fri Aug 22 14:17:31 2008 +0200
+++ b/objdictgen/objdictedit.py Thu Aug 28 14:24:22 2008 +0200
@@ -298,7 +298,7 @@
self.Manager = NodeManager()
for filepath in filesOpen:
result = self.Manager.OpenFileInCurrent(filepath)
- if type(result) == IntType:
+ if isinstance(result, (IntType, LongType)):
new_editingpanel = EditingPanel(self.FileOpened, self, self.Manager)
new_editingpanel.SetIndex(result)
self.FileOpened.AddPage(new_editingpanel, "")
@@ -389,13 +389,13 @@
find_index = True
index, subIndex = result
result = OpenPDFDocIndex(index, ScriptDirectory)
- if type(result) == StringType:
+ if isinstance(result, (StringType, UnicodeType)):
message = wx.MessageDialog(self, result, "ERROR", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
if not find_index:
result = OpenPDFDocIndex(None, ScriptDirectory)
- if type(result) == StringType:
+ if isinstance(result, (StringType, UnicodeType)):
message = wx.MessageDialog(self, result, "ERROR", wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
@@ -598,7 +598,7 @@
NMT = dialog.GetNMTManagement()
options = dialog.GetOptions()
result = self.Manager.CreateNewNode(name, id, nodetype, description, profile, filepath, NMT, options)
- if type(result) == IntType:
+ if isinstance(result, (IntType, LongType)):
new_editingpanel = EditingPanel(self.FileOpened, self, self.Manager)
new_editingpanel.SetIndex(result)
self.FileOpened.AddPage(new_editingpanel, "")
@@ -627,7 +627,7 @@
filepath = dialog.GetPath()
if os.path.isfile(filepath):
result = self.Manager.OpenFileInCurrent(filepath)
- if type(result) == IntType:
+ if isinstance(result, (IntType, LongType)):
new_editingpanel = EditingPanel(self.FileOpened, self, self.Manager)
new_editingpanel.SetIndex(result)
self.FileOpened.AddPage(new_editingpanel, "")
@@ -663,7 +663,7 @@
result = self.Manager.SaveCurrentInFile()
if not result:
self.SaveAs()
- elif type(result) != StringType:
+ elif not isinstance(result, (StringType, UnicodeType)):
self.RefreshBufferState()
else:
message = wx.MessageDialog(self, result, "Error", wx.OK|wx.ICON_ERROR)
@@ -681,7 +681,7 @@
filepath = dialog.GetPath()
if os.path.isdir(os.path.dirname(filepath)):
result = self.Manager.SaveCurrentInFile(filepath)
- if type(result) != StringType:
+ if not isinstance(result, (StringType, UnicodeType)):
self.RefreshBufferState()
else:
message = wx.MessageDialog(self, result, "Error", wx.OK|wx.ICON_ERROR)
@@ -726,7 +726,7 @@
filepath = dialog.GetPath()
if os.path.isfile(filepath):
result = self.Manager.ImportCurrentFromEDSFile(filepath)
- if type(result) == IntType:
+ if isinstance(result, (IntType, LongType)):
new_editingpanel = EditingPanel(self.FileOpened, self, self.Manager)
new_editingpanel.SetIndex(result)
self.FileOpened.AddPage(new_editingpanel, "")
@@ -881,7 +881,7 @@
if dialog.ShowModal() == wx.ID_OK:
index, name, struct, number = dialog.GetValues()
result = self.Manager.AddMapVariableToCurrent(index, name, struct, number)
- if type(result) != StringType:
+ if not isinstance(result, (StringType, UnicodeType)):
self.RefreshBufferState()
self.RefreshCurrentIndexList()
else:
--- a/objdictgen/objdictgen.py Fri Aug 22 14:17:31 2008 +0200
+++ b/objdictgen/objdictgen.py Thu Aug 28 14:24:22 2008 +0200
@@ -57,7 +57,7 @@
if os.path.isfile(fileIn):
print "Parsing input file"
result = manager.OpenFileInCurrent(fileIn)
- if type(result) != UnicodeType:
+ if not isinstance(result, (StringType, UnicodeType)):
Node = result
else:
print result
@@ -67,7 +67,7 @@
sys.exit(-1)
print "Writing output file"
result = manager.ExportCurrentToCFile(fileOut)
- if type(result) == UnicodeType:
+ if isinstance(result, (UnicodeType, StringType)):
print result
sys.exit(-1)
print "All done"