Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added combo box to allow preview of style (#10) #11

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions latest/dimensions.inx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<option value="ft">ft</option>
<option value="px">pixel</option>
</param>
<param name="LINscaleDim" type="float" min="0.01" max="100" precision="2" gui-text="Sale factor¹:">1.0</param>
<param name="LINscaleDim" type="float" min="0.01" max="10000" precision="2" gui-text="Sale factor¹:">1.0</param>
<param name="LINprecision" type="int" min="0" max="5" gui-text="Digits of precision:">0</param>
<param name="LINunitSymbol" type="bool" gui-text="Add unit symbol">false</param>
</page>
Expand All @@ -49,6 +49,8 @@
</param>
</vbox>
</hbox>
<spacer size="expand"/>
<label>¹ default: 1.0.</label>
</page>
<page name="Angular" appearance="minimal" gui-text="Angular">
<hbox>
Expand Down Expand Up @@ -94,6 +96,8 @@
<page name="Arrow" appearance="minimal" gui-text="Arrows">
<param name="anotationScale" type="float" min="0.01" max="100" precision="2" gui-text="Scale factor¹:">1.0</param>
<param name="anotationText" type="string" appearance="multiline" gui-text="Contents:">value</param>
<spacer size="expand"/>
<label>¹ default: 1.0.</label>
</page>
<page name="Config" appearance="minimal" gui-text="Configuration">
<param name="useLatex" type="bool" gui-text="Use LaTeX">false</param>
Expand Down Expand Up @@ -170,7 +174,11 @@
<label appearance="url">https://github.com/fsmMLK/inkscapeDimensions</label>
</page>
</param>
<label>¹ default: 1.0.</label>
<param name="dimensionType" type="optiongroup" appearance="combo" gui-text="Type:">
<option value="Linear">Linear</option>
<option value="Angular">Angular</option>
<option value="Arrow">Arrow</option>
</param>
<effect>
<object-type>all</object-type>
<effects-menu>
Expand Down
8 changes: 5 additions & 3 deletions latest/dimensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ def __init__(self):
self.arg_parser.add_argument("--lineColor", type=str, dest="lineColorOption", default='black')
self.arg_parser.add_argument("--colorPickerLine", type=str, dest="colorPickerLine", default='0')

self.arg_parser.add_argument("--dimensionType", type=str, dest="dimensionType", default='Linear')

def effect(self):

so = self.options
Expand Down Expand Up @@ -224,7 +226,7 @@ def effect(self):
self.annotationLineStyle = inkDraw.lineStyle.set(lineWidth=self.lineWidth * so.anotationScale, lineColor=self.lineColor,
markerStart=arrowStart)

if so.tab == 'Linear':
if self.options.dimensionType == 'Linear':
# get points of selected object
for id, element in self.svg.selected.items():
[P1, P2] = self.getPointsLinDim(element, so.LINdirection)
Expand All @@ -239,7 +241,7 @@ def effect(self):
if so.removeAuxLine:
self.removeElement(element)

if so.tab == 'Angular':
if self.options.dimensionType == 'Angular':
# get points of selected object
for id, element in self.svg.selected.items():
self.drawAngDim(root_layer, element, label='Dim', invertAngle=so.ANGinvertAngle, textType=so.AngContents_subtab,
Expand All @@ -249,7 +251,7 @@ def effect(self):
if so.removeAuxLine:
self.removeElement(element)

if so.tab == 'Arrow':
if self.options.dimensionType == 'Arrow':
for id, element in self.svg.selected.items():
self.drawAnnotationArrow(root_layer, element, contents=so.anotationText, scale=so.anotationScale)
self.removeElement(element)
Expand Down