summaryrefslogtreecommitdiff
path: root/lib/extensions
diff options
context:
space:
mode:
Diffstat (limited to 'lib/extensions')
-rw-r--r--lib/extensions/embroider.py2
-rw-r--r--lib/extensions/install.py11
-rw-r--r--lib/extensions/params.py55
3 files changed, 52 insertions, 16 deletions
diff --git a/lib/extensions/embroider.py b/lib/extensions/embroider.py
index 921201d6..7c8adfc9 100644
--- a/lib/extensions/embroider.py
+++ b/lib/extensions/embroider.py
@@ -39,7 +39,7 @@ class Embroider(InkstitchExtension):
def get_output_path(self):
if self.options.output_file:
- output_path = os.path.join(self.options.path, self.options.output_file)
+ output_path = os.path.join(os.path.expanduser(os.path.expandvars(self.options.path)), self.options.output_file)
else:
csv_filename = '%s.%s' % (self.get_base_file_name(), self.options.output_format)
output_path = os.path.join(self.options.path, csv_filename)
diff --git a/lib/extensions/install.py b/lib/extensions/install.py
index eb9f5289..c6dadd42 100644
--- a/lib/extensions/install.py
+++ b/lib/extensions/install.py
@@ -56,6 +56,13 @@ class InstallerFrame(wx.Frame):
self.path_input.SetValue(dialog.GetPath())
def install_button_clicked(self, event):
+ if sys.platform == "win32":
+ # On windows, the default icon shows as a broken image. No idea
+ # why. Workaround: don't show an icon.
+ style = wx.ICON_NONE
+ else:
+ style = 0
+
try:
self.install_addons('palettes')
self.install_addons('symbols')
@@ -63,12 +70,12 @@ class InstallerFrame(wx.Frame):
wx.MessageDialog(self,
_('Inkscape add-on installation failed') + ': \n' + traceback.format_exc(),
_('Installation Failed'),
- wx.OK).ShowModal()
+ wx.OK | style).ShowModal()
else:
wx.MessageDialog(self,
_('Inkscape add-on files have been installed. Please restart Inkscape to load the new add-ons.'),
_('Installation Completed'),
- wx.OK).ShowModal()
+ wx.OK | style).ShowModal()
self.Destroy()
diff --git a/lib/extensions/params.py b/lib/extensions/params.py
index c9c994c9..784b6be7 100644
--- a/lib/extensions/params.py
+++ b/lib/extensions/params.py
@@ -17,7 +17,7 @@ from .base import InkstitchExtension
from ..i18n import _
from ..stitch_plan import patches_to_stitch_plan
from ..elements import EmbroideryElement, Fill, AutoFill, Stroke, SatinColumn
-from ..utils import save_stderr, restore_stderr
+from ..utils import save_stderr, restore_stderr, get_resource_dir
from ..simulator import EmbroiderySimulator
from ..commands import is_command
@@ -112,10 +112,14 @@ class ParamsTab(ScrolledPanel):
else:
self.toggle = None
- self.settings_grid = wx.FlexGridSizer(rows=0, cols=3, hgap=10, vgap=10)
- self.settings_grid.AddGrowableCol(0, 1)
+ self.param_change_indicators = {}
+
+ self.settings_grid = wx.FlexGridSizer(rows=0, cols=4, hgap=10, vgap=15)
+ self.settings_grid.AddGrowableCol(1, 2)
self.settings_grid.SetFlexibleDirection(wx.HORIZONTAL)
+ self.pencil_icon = wx.Image(os.path.join(get_resource_dir("icons"), "pencil_20x20.png")).ConvertToBitmap()
+
self.__set_properties()
self.__do_layout()
@@ -218,7 +222,11 @@ class ParamsTab(ScrolledPanel):
self.on_change_hook = callable
def changed(self, event):
- self.changed_inputs.add(event.GetEventObject())
+ input = event.GetEventObject()
+ self.changed_inputs.add(input)
+
+ param = self.inputs_to_params[input]
+ self.enable_change_indicator(param)
event.Skip()
if self.on_change_hook:
@@ -235,9 +243,7 @@ class ParamsTab(ScrolledPanel):
self.update_toggle_state()
def save_preset(self, storage):
- preset = storage[self.name] = {}
- for name, input in self.param_inputs.iteritems():
- preset[name] = input.GetValue()
+ storage[self.name] = self.get_values()
def update_description(self):
if len(self.nodes) == 1:
@@ -296,13 +302,17 @@ class ParamsTab(ScrolledPanel):
box.Add(sizer, proportion=0, flag=wx.ALL, border=5)
if self.toggle:
- box.Add(self.toggle_checkbox, proportion=0, flag=wx.BOTTOM, border=10)
+ toggle_sizer = wx.BoxSizer(wx.HORIZONTAL)
+ toggle_sizer.Add(self.create_change_indicator(self.toggle.name), proportion = 0, flag=wx.ALIGN_CENTER_VERTICAL|wx.RIGHT, border=5)
+ toggle_sizer.Add(self.toggle_checkbox, proportion=0, flag=wx.ALIGN_CENTER_VERTICAL)
+ box.Add(toggle_sizer, proportion=0, flag=wx.BOTTOM, border=10)
for param in self.params:
+ self.settings_grid.Add(self.create_change_indicator(param.name), proportion=0, flag=wx.ALIGN_CENTER_VERTICAL)
+
description = wx.StaticText(self, label=param.description)
description.SetToolTip(param.tooltip)
-
- self.settings_grid.Add(description, proportion=1, flag=wx.EXPAND|wx.RIGHT, border=40)
+ self.settings_grid.Add(description, proportion=1, flag=wx.EXPAND|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL|wx.TOP, border=5)
if param.type == 'boolean':
@@ -316,7 +326,7 @@ class ParamsTab(ScrolledPanel):
input.Bind(wx.EVT_CHECKBOX, self.changed)
elif len(param.values) > 1:
- input = wx.ComboBox(self, wx.ID_ANY, choices=sorted(param.values), style=wx.CB_DROPDOWN)
+ input = wx.ComboBox(self, wx.ID_ANY, choices=sorted(str(value) for value in param.values), style=wx.CB_DROPDOWN)
input.Bind(wx.EVT_COMBOBOX, self.changed)
input.Bind(wx.EVT_TEXT, self.changed)
else:
@@ -326,14 +336,33 @@ class ParamsTab(ScrolledPanel):
self.param_inputs[param.name] = input
- self.settings_grid.Add(input, proportion=1, flag=wx.ALIGN_CENTER_VERTICAL)
+ self.settings_grid.Add(input, proportion=1, flag=wx.ALIGN_CENTER_VERTICAL|wx.EXPAND|wx.LEFT, border=40)
self.settings_grid.Add(wx.StaticText(self, label=param.unit or ""), proportion=1, flag=wx.ALIGN_CENTER_VERTICAL)
+ self.inputs_to_params = {v: k for k, v in self.param_inputs.iteritems()}
+
box.Add(self.settings_grid, proportion=1, flag=wx.ALL, border=10)
self.SetSizer(box)
self.Layout()
+ def create_change_indicator(self, param):
+ indicator = wx.Button(self, style=wx.BORDER_NONE | wx.BU_NOTEXT, size=(28, 28))
+ indicator.SetToolTip(_('Click to force this parameter to be saved when you click "Apply and Quit"'))
+ indicator.Bind(wx.EVT_BUTTON, lambda event: self.enable_change_indicator(param))
+
+ self.param_change_indicators[param] = indicator
+ return indicator
+
+ def enable_change_indicator(self, param):
+ self.param_change_indicators[param].SetBitmapLabel(self.pencil_icon)
+ self.param_change_indicators[param].SetToolTip(_('This parameter will be saved when you click "Apply and Quit"'))
+
+ self.changed_inputs.add(self.param_inputs[param])
+
+ if self.on_change_hook():
+ self.on_change_hook(self)
+
# end of class SatinPane
class SettingsFrame(wx.Frame):
@@ -686,7 +715,7 @@ class Params(InkstitchExtension):
getter = 'get_param'
values = filter(lambda item: item is not None,
- (getattr(node, getter)(param.name, str(param.default)) for node in nodes))
+ (getattr(node, getter)(param.name, param.default) for node in nodes))
return values