add change indicator to Params (#217)

pull/301/head
Lex Neva 2018-09-01 16:26:47 -04:00
rodzic 1531e8f520
commit e2b5e96834
5 zmienionych plików z 86 dodań i 45 usunięć

Wyświetl plik

@ -11,9 +11,9 @@ dist: distclean locales inx
cp -a images/examples dist/inkstitch
cp -a palettes dist/inkstitch
cp -a symbols dist/inkstitch
mkdir -p dist/inkstitch/bin/locales
cp -a locales/* dist/inkstitch/bin/locales
cp -a print dist/inkstitch/bin/
cp -a icons dist/inkstitch/bin
cp -a locales dist/inkstitch/bin
cp -a print dist/inkstitch/bin
if [ "$$BUILD" = "windows" ]; then \
cd dist; zip -r ../inkstitch-$(VERSION)-win32.zip *; \
else \

BIN
icons/pencil.png 100644

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 15 KiB

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 734 B

Wyświetl plik

@ -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_bundled_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_bundled_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:
@ -297,13 +305,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':
@ -327,14 +339,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):

Wyświetl plik

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2018-08-24 21:44-0400\n"
"POT-Creation-Date: 2018-09-01 16:26-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -501,7 +501,7 @@ msgstr ""
msgid "Install"
msgstr ""
#: lib/extensions/install.py:40 lib/extensions/params.py:380
#: lib/extensions/install.py:40 lib/extensions/params.py:411
msgid "Cancel"
msgstr ""
@ -557,94 +557,104 @@ msgstr ""
msgid "Please choose one or more commands to attach."
msgstr ""
#: lib/extensions/params.py:244
#: lib/extensions/params.py:252
msgid "These settings will be applied to 1 object."
msgstr ""
#: lib/extensions/params.py:246
#: lib/extensions/params.py:254
#, python-format
msgid "These settings will be applied to %d objects."
msgstr ""
#: lib/extensions/params.py:249
#: lib/extensions/params.py:257
msgid ""
"Some settings had different values across objects. Select a value from "
"the dropdown or enter a new one."
msgstr ""
#: lib/extensions/params.py:253
#: lib/extensions/params.py:261
#, python-format
msgid "Disabling this tab will disable the following %d tabs."
msgstr ""
#: lib/extensions/params.py:255
#: lib/extensions/params.py:263
msgid "Disabling this tab will disable the following tab."
msgstr ""
#: lib/extensions/params.py:258
#: lib/extensions/params.py:266
#, python-format
msgid "Enabling this tab will disable %s and vice-versa."
msgstr ""
#: lib/extensions/params.py:288
#: lib/extensions/params.py:296
msgid "Inkscape objects"
msgstr ""
#: lib/extensions/params.py:346
msgid "Embroidery Params"
#: lib/extensions/params.py:354
msgid ""
"Click to force this parameter to be saved when you click \"Apply and "
"Quit\""
msgstr ""
#: lib/extensions/params.py:363
msgid "Presets"
msgstr ""
#: lib/extensions/params.py:368
msgid "Load"
msgstr ""
#: lib/extensions/params.py:371
msgid "Add"
msgstr ""
#: lib/extensions/params.py:374
msgid "Overwrite"
#: lib/extensions/params.py:362
msgid "This parameter will be saved when you click \"Apply and Quit\""
msgstr ""
#: lib/extensions/params.py:377
msgid "Embroidery Params"
msgstr ""
#: lib/extensions/params.py:394
msgid "Presets"
msgstr ""
#: lib/extensions/params.py:399
msgid "Load"
msgstr ""
#: lib/extensions/params.py:402
msgid "Add"
msgstr ""
#: lib/extensions/params.py:405
msgid "Overwrite"
msgstr ""
#: lib/extensions/params.py:408
msgid "Delete"
msgstr ""
#: lib/extensions/params.py:384
#: lib/extensions/params.py:415
msgid "Use Last Settings"
msgstr ""
#: lib/extensions/params.py:387
#: lib/extensions/params.py:418
msgid "Apply and Quit"
msgstr ""
#: lib/extensions/params.py:439
#: lib/extensions/params.py:470
msgid "Preview"
msgstr ""
#: lib/extensions/params.py:458
#: lib/extensions/params.py:489
msgid "Internal Error"
msgstr ""
#: lib/extensions/params.py:511
#: lib/extensions/params.py:542
msgid "Please enter or select a preset name first."
msgstr ""
#: lib/extensions/params.py:511 lib/extensions/params.py:517
#: lib/extensions/params.py:545
#: lib/extensions/params.py:542 lib/extensions/params.py:548
#: lib/extensions/params.py:576
msgid "Preset"
msgstr ""
#: lib/extensions/params.py:517
#: lib/extensions/params.py:548
#, python-format
msgid "Preset \"%s\" not found."
msgstr ""
#: lib/extensions/params.py:545
#: lib/extensions/params.py:576
#, python-format
msgid ""
"Preset \"%s\" already exists. Please use another name or press "