|
|
@@ -1,7 +1,12 @@
|
|
|
###################
|
|
|
# Gui Data Types
|
|
|
###################
|
|
|
-
|
|
|
+# from GuiType import (_GuiForm,_GuiFormMulti,_GuiTreeRow,_GuiTree,_GuiWinText,
|
|
|
+# _GuiWinLinedText,_GuiWinForm,_GuiWinFormMulti,_GuiWinTree,_GuiSideBar,
|
|
|
+# _GuiMessage, _GuiMessages,)
|
|
|
+__all__ = ["_GuiForm","_GuiFormMulti","_GuiTreeRow","_GuiTree","_GuiWinText",
|
|
|
+ "_GuiWinLinedText","_GuiWinForm","_GuiWinFormMulti","_GuiWinTree","_GuiSideBar",
|
|
|
+ "_GuiMessage", "_GuiMessages",]
|
|
|
|
|
|
class _GuiForm():
|
|
|
def __init__(self, fixed_row, rows):
|
|
|
@@ -112,19 +117,32 @@ class _GuiSideBar():
|
|
|
assert isinstance(formrow, list)
|
|
|
return _GuiWinForm(str(formname)+" Properties", _GuiForm(["Name", "Property"], [[x, "property"] for x in treenames+formrow]))
|
|
|
|
|
|
-
|
|
|
-class _GuiMessages(): # to be further defined
|
|
|
- def __init__(self):
|
|
|
- self.Infos = []
|
|
|
- self.Warnings = []
|
|
|
- self.CriticalWarnings = []
|
|
|
- self.Errors = []
|
|
|
-
|
|
|
- def CrossProbe(self, filename, line):
|
|
|
- return _GuiWinLinedText(filename, ("Text Start\n\n"+'\n'.join(['generated line '+str(x) for x in range(line*2)])+"\n\nText End").split("\n"), line)
|
|
|
-
|
|
|
- def __init__(self, info, warn, crit, err):
|
|
|
- self.Infos = info
|
|
|
- self.Warnings = warn
|
|
|
- self.CriticalWarnings = crit
|
|
|
- self.Errors = err
|
|
|
+class _GuiMessage(): # _GuiMessage("This is an error!!!", 100, "/x/xx.v")
|
|
|
+ def __init__(self, text, line, filepath):
|
|
|
+ self.Text = text
|
|
|
+ self.Line = line
|
|
|
+ self.FilePath = filepath
|
|
|
+ def GetHint(self):
|
|
|
+ return "line: "+str(self.Line)+", file: "+self.FilePath
|
|
|
+ def CrossProbe(self):
|
|
|
+ return _GuiWinLinedText(self.FilePath, ("Text Start\n\n"+'\n'.join(['generated line '+str(x) for x in range(3, self.Line*2)])+"\n\nText End").split("\n"), self.Line)
|
|
|
+ def Properties(self):
|
|
|
+ return _GuiWinForm("Message Properties", _GuiForm(["Name", "Property"], [["File", self.FilePath], ["Line", str(self.Line)]]))
|
|
|
+
|
|
|
+class _GuiMessages(): # _GuiMessages([["Err-123","This is an error",[_GuiMessage("This is an error!", 100, "/x/x.v"),_GuiMessage("This is an error!!", 200, "/xx/xx.v")]]])
|
|
|
+ def __init__(self, id_messages):
|
|
|
+ self.Size = 0
|
|
|
+ self._summary = []
|
|
|
+ self._messages = {}
|
|
|
+ for idm in id_messages:
|
|
|
+ assert len(idm) == 3
|
|
|
+ assert isinstance(idm[0], str) and idm[0] != "" # "Err-123"
|
|
|
+ assert isinstance(idm[1], str) # "This is an error"
|
|
|
+ assert isinstance(idm[2], list) and len(idm[2]) > 0 # [_GuiMessage(), _GuiMessage()]
|
|
|
+ self.Size += len(idm[2])
|
|
|
+ self._summary.append([idm[0], len(idm[2]), idm[1]])
|
|
|
+ self._messages[idm[0]] = idm[2]
|
|
|
+ def GetSummary(self): # [["Err-123", 2, "This is an error"],]
|
|
|
+ return self._summary
|
|
|
+ def GetMsgByID(self, ID): # [_GuiMessage(), _GuiMessage()]
|
|
|
+ return self._messages[ID]
|