Adding support for Viewer font
authorlbessard
Mon, 28 Jan 2008 11:15:24 +0100
changeset 158 8a770e8d745a
parent 157 e4e8bc2e3e1a
child 159 76b2facf14a2
Adding support for Viewer font
Viewer.py
examples/example.xml
--- a/Viewer.py	Mon Jan 28 10:48:16 2008 +0100
+++ b/Viewer.py	Mon Jan 28 11:15:24 2008 +0100
@@ -44,14 +44,14 @@
               'mono' : 'Courier New',
               'helv' : 'Arial',
               'other': 'Comic Sans MS',
-              'size' : 10,
+              'size' : 20,
              }
 else:
     faces = { 'times': 'Times',
               'mono' : 'Courier',
               'helv' : 'Helvetica',
               'other': 'new century schoolbook',
-              'size' : 12,
+              'size' : 20,
              }
 
 #-------------------------------------------------------------------------------
@@ -317,12 +317,12 @@
         dc = wx.ClientDC(self)
         self.Font = wx.Font(faces["size"], wx.DEFAULT, wx.NORMAL, wx.NORMAL, faceName = faces["mono"])
         dc.SetFont(self.Font)
-        width, height = dc.GetTextExtent("A")
-        while height > 17:
+        width, height = dc.GetTextExtent("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
+        while width > 260:
             faces["size"] -= 1
             self.Font = wx.Font(faces["size"], wx.DEFAULT, wx.NORMAL, wx.NORMAL, faceName = faces["mono"])
             dc.SetFont(self.Font)
-            width, height = dc.GetTextExtent("A")
+            width, height = dc.GetTextExtent("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
         
         # Link Viewer event to corresponding methods
         self.Bind(wx.EVT_PAINT, self.OnPaint)
--- a/examples/example.xml	Mon Jan 28 10:48:16 2008 +0100
+++ b/examples/example.xml	Mon Jan 28 11:15:24 2008 +0100
@@ -12,7 +12,7 @@
               contentDescription="Example of PLCOpenEditor usage"/>
   <contentHeader name="Test"
                  version="1"
-                 modificationDateTime="2008-01-22 11:01:23"
+                 modificationDateTime="2008-01-28 11:02:45"
                  author="Laurent Bessard"
                  language="en-US">
     <coordinateInfo>
@@ -245,7 +245,7 @@
                 </variable>
               </outputVariables>
             </block>
-            <comment localId="10" height="40" width="272">
+            <comment localId="10" height="40" width="376">
               <position x="240" y="24"/>
               <content>
 <![CDATA[POU used for testing PLCOpenEditor.]]>
@@ -707,10 +707,10 @@
         </transitions>
         <body>
           <SFC>
-            <step localId="1" height="31" width="46" name="Start" initialStep="true">
-              <position x="82" y="46"/>
-              <connectionPointOut formalParameter="None">
-                <relPosition x="23" y="31"/>
+            <step localId="1" height="38" width="69" name="Start" initialStep="true">
+              <position x="71" y="39"/>
+              <connectionPointOut formalParameter="">
+                <relPosition x="34" y="38"/>
               </connectionPointOut>
             </step>
             <transition localId="2" height="2" width="20">
@@ -729,20 +729,20 @@
                 <reference name="TR1"/>
               </condition>
             </transition>
-            <step localId="3" height="27" width="29" name="Init">
-              <position x="91" y="129"/>
-              <connectionPointIn>
-                <relPosition x="14" y="0"/>
+            <step localId="3" height="27" width="52" name="Init">
+              <position x="79" y="129"/>
+              <connectionPointIn>
+                <relPosition x="26" y="0"/>
                 <connection refLocalId="2">
                   <position x="105" y="129"/>
                   <position x="105" y="104"/>
                 </connection>
               </connectionPointIn>
-              <connectionPointOut formalParameter="None">
-                <relPosition x="14" y="27"/>
-              </connectionPointOut>
-              <connectionPointOutAction formalParameter="None">
-                <relPosition x="29" y="13"/>
+              <connectionPointOut formalParameter="">
+                <relPosition x="26" y="27"/>
+              </connectionPointOut>
+              <connectionPointOutAction formalParameter="">
+                <relPosition x="52" y="13"/>
               </connectionPointOutAction>
             </step>
             <selectionDivergence localId="4" height="1" width="391">
@@ -754,13 +754,13 @@
                   <position x="105" y="156"/>
                 </connection>
               </connectionPointIn>
-              <connectionPointOut formalParameter="None">
+              <connectionPointOut formalParameter="">
                 <relPosition x="0" y="1"/>
               </connectionPointOut>
-              <connectionPointOut formalParameter="None">
+              <connectionPointOut formalParameter="">
                 <relPosition x="228" y="1"/>
               </connectionPointOut>
-              <connectionPointOut formalParameter="None">
+              <connectionPointOut formalParameter="">
                 <relPosition x="391" y="1"/>
               </connectionPointOut>
             </selectionDivergence>
@@ -784,17 +784,17 @@
                 </inline>
               </condition>
             </transition>
-            <step localId="6" height="27" width="48" name="Step1">
-              <position x="81" y="262"/>
-              <connectionPointIn>
-                <relPosition x="24" y="0"/>
+            <step localId="6" height="37" width="63" name="Step1">
+              <position x="74" y="262"/>
+              <connectionPointIn>
+                <relPosition x="31" y="0"/>
                 <connection refLocalId="21">
                   <position x="105" y="262"/>
                   <position x="105" y="237"/>
                 </connection>
               </connectionPointIn>
-              <connectionPointOut formalParameter="None">
-                <relPosition x="24" y="27"/>
+              <connectionPointOut formalParameter="">
+                <relPosition x="31" y="37"/>
               </connectionPointOut>
             </step>
             <transition localId="7" height="2" width="20" priority="1">
@@ -813,17 +813,17 @@
                 <reference name="TR2"/>
               </condition>
             </transition>
-            <step localId="8" height="27" width="48" name="Step2">
-              <position x="309" y="234"/>
-              <connectionPointIn>
-                <relPosition x="24" y="0"/>
+            <step localId="8" height="35" width="57" name="Step2">
+              <position x="305" y="234"/>
+              <connectionPointIn>
+                <relPosition x="28" y="0"/>
                 <connection refLocalId="7">
                   <position x="333" y="234"/>
                   <position x="333" y="209"/>
                 </connection>
               </connectionPointIn>
-              <connectionPointOut formalParameter="None">
-                <relPosition x="24" y="27"/>
+              <connectionPointOut formalParameter="">
+                <relPosition x="28" y="35"/>
               </connectionPointOut>
             </step>
             <transition localId="9" height="2" width="20">
@@ -842,29 +842,29 @@
                 <reference name="TR4"/>
               </condition>
             </transition>
-            <step localId="10" height="27" width="48" name="Step3">
-              <position x="472" y="234"/>
-              <connectionPointIn>
-                <relPosition x="24" y="0"/>
+            <step localId="10" height="36" width="60" name="Step3">
+              <position x="466" y="234"/>
+              <connectionPointIn>
+                <relPosition x="30" y="0"/>
                 <connection refLocalId="9">
                   <position x="496" y="234"/>
                   <position x="496" y="209"/>
                 </connection>
               </connectionPointIn>
-              <connectionPointOut formalParameter="None">
-                <relPosition x="24" y="27"/>
-              </connectionPointOut>
-              <connectionPointOutAction formalParameter="None">
-                <relPosition x="48" y="13"/>
+              <connectionPointOut formalParameter="">
+                <relPosition x="30" y="36"/>
+              </connectionPointOut>
+              <connectionPointOutAction formalParameter="">
+                <relPosition x="60" y="18"/>
               </connectionPointOutAction>
             </step>
             <transition localId="11" height="2" width="20">
-              <position x="95" y="342"/>
+              <position x="95" y="362"/>
               <connectionPointIn>
                 <relPosition x="10" y="0"/>
                 <connection refLocalId="23">
-                  <position x="105" y="342"/>
-                  <position x="105" y="317"/>
+                  <position x="105" y="362"/>
+                  <position x="105" y="337"/>
                 </connection>
               </connectionPointIn>
               <connectionPointOut>
@@ -875,22 +875,22 @@
               </condition>
             </transition>
             <jumpStep localId="12" height="13" width="12" targetName="Start">
-              <position x="99" y="369"/>
+              <position x="99" y="389"/>
               <connectionPointIn>
                 <relPosition x="6" y="0"/>
                 <connection refLocalId="11">
-                  <position x="105" y="369"/>
-                  <position x="105" y="344"/>
+                  <position x="105" y="389"/>
+                  <position x="105" y="364"/>
                 </connection>
               </connectionPointIn>
             </jumpStep>
             <actionBlock localId="13" height="30" width="100">
-              <position x="145" y="127"/>
+              <position x="175" y="127"/>
               <connectionPointIn>
                 <relPosition x="0" y="15"/>
                 <connection refLocalId="3">
-                  <position x="145" y="142"/>
-                  <position x="120" y="142"/>
+                  <position x="175" y="142"/>
+                  <position x="131" y="142"/>
                 </connection>
               </connectionPointIn>
               <action>
@@ -898,19 +898,19 @@
               </action>
             </actionBlock>
             <transition localId="14" height="2" width="20">
-              <position x="323" y="286"/>
+              <position x="323" y="294"/>
               <connectionPointIn>
                 <relPosition x="10" y="0"/>
                 <connection refLocalId="8">
-                  <position x="333" y="286"/>
-                  <position x="333" y="261"/>
+                  <position x="333" y="294"/>
+                  <position x="333" y="269"/>
                 </connection>
               </connectionPointIn>
               <connectionPointOut>
                 <relPosition x="10" y="2"/>
               </connectionPointOut>
               <condition>
-                <inline name="None">
+                <inline name="">
                   <ST>
 <![CDATA[IN5]]>
                   </ST>
@@ -923,14 +923,14 @@
                 <relPosition x="10" y="0"/>
                 <connection refLocalId="10">
                   <position x="496" y="346"/>
-                  <position x="496" y="261"/>
+                  <position x="496" y="270"/>
                 </connection>
               </connectionPointIn>
               <connectionPointOut>
                 <relPosition x="10" y="2"/>
               </connectionPointOut>
               <condition>
-                <inline name="None">
+                <inline name="">
                   <ST>
 <![CDATA[IN5]]>
                   </ST>
@@ -943,7 +943,7 @@
                 <relPosition x="0" y="0"/>
                 <connection refLocalId="14">
                   <position x="333" y="373"/>
-                  <position x="333" y="288"/>
+                  <position x="333" y="296"/>
                 </connection>
               </connectionPointIn>
               <connectionPointIn>
@@ -967,13 +967,13 @@
                 </connection>
               </connectionPointIn>
             </jumpStep>
-            <actionBlock localId="20" height="90" width="173">
-              <position x="545" y="232"/>
+            <actionBlock localId="20" height="90" width="237">
+              <position x="582" y="237"/>
               <connectionPointIn>
                 <relPosition x="0" y="15"/>
                 <connection refLocalId="10">
-                  <position x="545" y="247"/>
-                  <position x="520" y="247"/>
+                  <position x="582" y="252"/>
+                  <position x="526" y="252"/>
                 </connection>
               </connectionPointIn>
               <action indicator="IN5">
@@ -1006,33 +1006,33 @@
                 <relPosition x="118" y="3"/>
               </connectionPointOut>
             </simultaneousDivergence>
-            <step localId="22" height="27" width="48" name="Step4">
-              <position x="199" y="262"/>
-              <connectionPointIn>
-                <relPosition x="24" y="0"/>
+            <step localId="22" height="36" width="61" name="Step4">
+              <position x="193" y="261"/>
+              <connectionPointIn>
+                <relPosition x="30" y="0"/>
                 <connection refLocalId="21">
-                  <position x="223" y="262"/>
+                  <position x="223" y="261"/>
                   <position x="223" y="237"/>
                 </connection>
               </connectionPointIn>
-              <connectionPointOut formalParameter="None">
-                <relPosition x="24" y="27"/>
+              <connectionPointOut formalParameter="">
+                <relPosition x="30" y="36"/>
               </connectionPointOut>
             </step>
             <simultaneousConvergence localId="23" height="3" width="118">
-              <position x="105" y="314"/>
+              <position x="105" y="334"/>
               <connectionPointIn>
                 <relPosition x="0" y="0"/>
                 <connection refLocalId="6">
-                  <position x="105" y="314"/>
-                  <position x="105" y="289"/>
+                  <position x="105" y="334"/>
+                  <position x="105" y="299"/>
                 </connection>
               </connectionPointIn>
               <connectionPointIn>
                 <relPosition x="118" y="0"/>
                 <connection refLocalId="22">
-                  <position x="223" y="314"/>
-                  <position x="223" y="289"/>
+                  <position x="223" y="334"/>
+                  <position x="223" y="297"/>
                 </connection>
               </connectionPointIn>
               <connectionPointOut>