Skip to content

Commit

Permalink
Added Journal.Date and JournalBasicFileInfo.FileName
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Dieckmann committed Dec 16, 2017
1 parent c53c2d6 commit 6850a20
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 29 deletions.
7 changes: 6 additions & 1 deletion nodes/Journal.ByString.dyf
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class Journal:
def ContainsExceptions(self):
if len([x for x in self.GetLinesByType('JournalTimeStamp') if x.Description.startswith("ExceptionCode")]) > 0: return True
else: return False
def GetDate(self):
return self.GetDateTimeByBlock(1).Date
def GetDateTimeByBlock(self, block):
if block == 0: return None
else: return [x for x in self.GetLinesByType('JournalTimeStamp') if x.Block == block][0].DateTime
Expand Down Expand Up @@ -172,6 +174,7 @@ class JournalBasicFileInfo(JournalLine):
self.CentralModelPath = None
self.LastSavePath = None
self.Locale = None
self.FileName = None
def __repr__(self):
return 'JournalBasicFileInfo'

Expand Down Expand Up @@ -359,7 +362,9 @@ for line in lineObjs:
bfidict = dict(zip(bfi[0], [x.strip() for x in bfi[1]]))
if bfidict["Worksharing"] != "": line.Worksharing = bfidict["Worksharing"]
if bfidict["CentralModelPath"] != "": line.CentralModelPath = bfidict["CentralModelPath"]
if bfidict["LastSavePath"] != "": line.LastSavePath = bfidict["LastSavePath"]
if bfidict["LastSavePath"] != "":
line.LastSavePath = bfidict["LastSavePath"]
line.FileName = bfidict["LastSavePath"].split("\\")[-1]
if bfidict["LocaleWhenSaved"] != "": line.Locale = bfidict["LocaleWhenSaved"]
elif line.Type == 'JournalGUIResourceUsage':
g2 = []
Expand Down
40 changes: 40 additions & 0 deletions nodes/Journal.Date.dyf
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<Workspace Version="1.3.1.1736" X="0" Y="0" zoom="1" ScaleFactor="1" Name="Journal.Date" Description="Computes the date of a given journal" ID="87ad3e95-f27d-4681-9952-02d475be154e" Category="Journalysis.Journal.Actions">
<NamespaceResolutionMap>
<ClassMap partialName="File" resolvedName="DSCore.IO.File" assemblyName="DSCoreNodes.dll" />
<ClassMap partialName="System.IO.FileInfo" resolvedName="System.IO.FileInfo" assemblyName="" />
<ClassMap partialName="List.Empty" resolvedName="DSCore.List" assemblyName="DSCoreNodes.dll" />
</NamespaceResolutionMap>
<Elements>
<PythonNodeModels.PythonNode guid="c14ddd63-f9df-4826-9acc-09a519a00407" type="PythonNodeModels.PythonNode" nickname="Python Script" x="250" y="0" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False" IsFrozen="false" isPinned="false" inputcount="1">
<PortInfo index="0" default="False" />
<Script>import clr

def process_input(func, input):
if isinstance(input, list): return [func(x) for x in input]
else: return func(input)

def journalDate(journal):
if journal.__repr__() == 'Journal': return journal.GetDate()
else: return None

OUT = process_input(journalDate,IN[0])</Script>
</PythonNodeModels.PythonNode>
<Dynamo.Graph.Nodes.CustomNodes.Symbol guid="dcd621e3-fa95-4de0-a8f0-785ac7af9754" type="Dynamo.Graph.Nodes.CustomNodes.Symbol" nickname="Input" x="0" y="0" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="True" IsFrozen="false" isPinned="false">
<Symbol value="journal" />
</Dynamo.Graph.Nodes.CustomNodes.Symbol>
<Dynamo.Graph.Nodes.CustomNodes.Output guid="21feff7b-450d-483b-9bf9-530880e60c7d" type="Dynamo.Graph.Nodes.CustomNodes.Output" nickname="Output" x="449" y="0" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False" IsFrozen="false" isPinned="false">
<PortInfo index="0" default="False" />
<Symbol value="dateTime" />
</Dynamo.Graph.Nodes.CustomNodes.Output>
</Elements>
<Connectors>
<Dynamo.Graph.Connectors.ConnectorModel start="c14ddd63-f9df-4826-9acc-09a519a00407" start_index="0" end="21feff7b-450d-483b-9bf9-530880e60c7d" end_index="0" portType="0" />
<Dynamo.Graph.Connectors.ConnectorModel start="dcd621e3-fa95-4de0-a8f0-785ac7af9754" start_index="0" end="c14ddd63-f9df-4826-9acc-09a519a00407" end_index="0" portType="0" />
</Connectors>
<Notes />
<Annotations />
<Presets />
<Cameras>
<Camera Name="Hintergrundvorschau" eyeX="-17" eyeY="24" eyeZ="50" lookX="12" lookY="-13" lookZ="-58" upX="0" upY="1" upZ="0" />
</Cameras>
</Workspace>
40 changes: 40 additions & 0 deletions nodes/JournalBasicFileInfo.FileName.dyf
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<Workspace Version="1.3.1.1736" X="0" Y="0" zoom="1" ScaleFactor="1" Name="JournalBasicFileInfo.FileName" Description="" ID="5f331f78-8449-4c4e-90cc-fe5cc0e72234" Category="Journalysis.JournalLine.BasicFileInfo.Query">
<NamespaceResolutionMap>
<ClassMap partialName="File" resolvedName="DSCore.IO.File" assemblyName="DSCoreNodes.dll" />
<ClassMap partialName="System.IO.FileInfo" resolvedName="System.IO.FileInfo" assemblyName="" />
<ClassMap partialName="List.Empty" resolvedName="DSCore.List" assemblyName="DSCoreNodes.dll" />
</NamespaceResolutionMap>
<Elements>
<PythonNodeModels.PythonNode guid="6ae6bac3-d2d2-4229-abc6-7ed43e0b8038" type="PythonNodeModels.PythonNode" nickname="Python Script" x="250" y="0" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False" IsFrozen="false" isPinned="true" inputcount="1">
<PortInfo index="0" default="False" />
<Script>import clr

def process_input(func, input):
if isinstance(input, list): return [func(x) for x in input]
else: return func(input)

def journalBFIFileName(jbfi):
if jbfi.__repr__() == 'JournalBasicFileInfo': return jbfi.FileName
else: return None

OUT = process_input(journalBFIFileName,IN[0])</Script>
</PythonNodeModels.PythonNode>
<Dynamo.Graph.Nodes.CustomNodes.Symbol guid="25386197-eed6-4bce-b67c-a353ad53e111" type="Dynamo.Graph.Nodes.CustomNodes.Symbol" nickname="Input" x="0" y="0" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="True" IsFrozen="false" isPinned="false">
<Symbol value="journalBasicFileInfo" />
</Dynamo.Graph.Nodes.CustomNodes.Symbol>
<Dynamo.Graph.Nodes.CustomNodes.Output guid="79a2ac07-f5e7-461f-97bb-b36eabb7827e" type="Dynamo.Graph.Nodes.CustomNodes.Output" nickname="Output" x="449" y="0" isVisible="true" isUpstreamVisible="true" lacing="Disabled" isSelectedInput="False" IsFrozen="false" isPinned="false">
<PortInfo index="0" default="False" />
<Symbol value="str" />
</Dynamo.Graph.Nodes.CustomNodes.Output>
</Elements>
<Connectors>
<Dynamo.Graph.Connectors.ConnectorModel start="6ae6bac3-d2d2-4229-abc6-7ed43e0b8038" start_index="0" end="79a2ac07-f5e7-461f-97bb-b36eabb7827e" end_index="0" portType="0" />
<Dynamo.Graph.Connectors.ConnectorModel start="25386197-eed6-4bce-b67c-a353ad53e111" start_index="0" end="6ae6bac3-d2d2-4229-abc6-7ed43e0b8038" end_index="0" portType="0" />
</Connectors>
<Notes />
<Annotations />
<Presets />
<Cameras>
<Camera Name="Hintergrundvorschau" eyeX="-17" eyeY="24" eyeZ="50" lookX="12" lookY="-13" lookZ="-58" upX="0" upY="1" upZ="0" />
</Cameras>
</Workspace>
Loading

0 comments on commit 6850a20

Please sign in to comment.