Commit Graph

22 Commits

Author SHA1 Message Date
Nico Tonnhofer bf72cb7f10 python3: pep8 all files.
e.g. 4 spaces for identation
using black for this:
https://github.com/ambv/black
2019-04-18 09:10:37 +02:00
Nico Tonnhofer 9b49097ac3 configtool: stage 1 for making it compatible with python3 2019-04-18 09:09:53 +02:00
Nico Tonnhofer 727d5dee66 configtool: use new wxPython 4
Installation/Update:
- Windows/macOS
    pip install -U wxPython

- Linux
    pip install -U wxPython
      - if it fails to install wxPython >= 4 go ahead, else you're done.

    Check https://extras.wxpython.org/wxPython4/extras/linux/gtk3/
    for e.g. Ubuntu 18.04:
      pip install -U \
      -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04/ \
      wxPython

check also https://wxpython.org/pages/downloads/ for further details.
2018-12-30 22:12:36 +01:00
Phil Hord 9d42fa4ac1 Configtool: speed up startup with wx-tricks.
This should fix issue #235.

Recently ConfigTool has been very slow for me on Ubuntu Linux.
When I run the app there is a 15 second wait before the window is
first displayed.  I bisected the problem and found it was tied to
the number of pins in `pinNames`, and ultimately that it was
caused by a slow initializer in wx.Choice() when the choices are
loaded when the widget is created.  For some reason, moving the
load after the widget is created is significantly faster.  This
change reduces my startup time to just under 4 seconds.

Further speedup could be had by using lazy initialization of the
controls.  But the controls are too bound up in the loaded data
to make this simple.  Maybe I will attack it later.

There is still a significant delay when closing the window, but I
haven't tracked what causes it.  Maybe it is caused just by
destroying all these pin controls.

In the process of making this change, I wanted to simplify the
number of locations that bothered to copy the pinNames list and,
to support lazy loading, to try to keep the same list in all
pinChoice controls.  I noticed that all the pinChoice controls
already have the same parameters passed to the addPinChoice
function which makes them redundant and confusing.  I removed the
extra initializers and just rely on pinNames as the only list
option in addPinChoice for now.  Maybe this flexibility is needed
for some reason later, but I can't see a purpose for it now.

Notes by reviewer Traumflug:

First of all, which "trick"? That's an excellent code
simplification and if this happens to make startup faster (it
does), all the better.

Measured startup & shutdown time here (click window close as soon
as it appears):

  Before:                With this commit:
  real    0m4.222s       real    0m3.780s
  user    0m3.864s       user    0m3.452s
  sys     0m0.084s       sys     0m0.100s

As the speedup was far more significant on the commit author's
machine, it might be a memory consumption issue (leading to
swapping on a small RAM machine). Linux allows to view this in
/proc/<pid>/status.

         Before:          Now:
VmPeak:	  708360 kB     708372 kB
VmSize:	  658916 kB     658756 kB
VmHWM:	   73792 kB      73492 kB
VmRSS:	   73792 kB      73492 kB
VmData:	  402492 kB     402332 kB

Still no obvious indicator, but a 300 kB smaller memory footprint
is certainly nice.
2016-10-26 22:00:21 +02:00
Markus Hitter c80b4d4d28 Revert "Configtool: attempt to fix broken pin definitions."
This worked only when the GUI came up, so a better fix was found
with commit

  "Configtool: deal with missing #defines requiring a value."
2016-06-05 21:07:54 +02:00
Markus Hitter 09bcb0cf42 Configtool: attempt to fix broken pin definitions.
We can't magically find out what the right pin is, but we can at
least make sure it gets written with valid syntax next time. This
also ensures pins can be handled in the GUI, avoiding failures
like the one reported by inline comments here:

b9fe0a5dd0
2016-06-01 13:20:14 +02:00
Markus Hitter eb8d918836 Configtool: implement tooltips for boolChoices.
Now these display bus type and display type choices have their
help text, too.
2016-05-30 14:31:40 +02:00
Markus Hitter ad021f7df7 Configtool: move handling of unused pins to parent class.
This shouldn't change behaviour.
2016-05-30 11:12:37 +02:00
Markus Hitter 7a18217dee Configtool: move choices value insertion to the parent class.
This shouldn't change behaviour.
2016-05-30 11:10:08 +02:00
Markus Hitter 13c76244b6 Configtool: allow and use user friendly names for choices.
So far for choices based on boolean sets, only, because choices
for values typically need no more readable names.

This elegantly removes the somewhat ugly check for '(', too.
2016-04-20 22:02:10 +02:00
Markus Hitter 2541d7a82c Configtool: introduce boolChoices.
This handles sets of booleans "magically" and is now used for
DISPLAY_BUS and DISPLAY_TYPE.
2016-04-20 22:02:10 +02:00
Markus Hitter 6b5156d459 Configtool: take advantage of the now recognized values.
This is for now to restore disabled values as well, not only
active ones. More uses are thinkable.
2015-07-17 13:38:15 +02:00
Markus Hitter 3795c7a36f Configtool: don't ignore disabled values.
Previously, values of ignored keys simply got lost and were
replaced with the ones from from the metadata file. Now this
value is preserved and perhaps, some time in the future, we'll
use this bit of information to to provide the right value when
re-enabling it.
2015-07-17 13:38:09 +02:00
Markus Hitter 27cf051f03 Configtool: de-duplicate insertValues().
No change in behaviour intended.
2015-07-17 13:38:02 +02:00
Markus Hitter b3bc26c6f4 Configtool: adjust background color of controls, too.
That is, buttons and choices. Coices apparently don't work. Tried
a bit on the table heaters of the sensor and heater lists, but
found nothing which would result in an effect. This control is
not exactly well documented.
2015-05-30 21:21:00 +02:00
Markus Hitter 9976640d92 Configtool: color background matching the background picture.
Actual color is easily changeable in Decoration, as this is a
Singleton.
2015-05-30 19:20:38 +02:00
Markus Hitter be16c98e59 Configtool: give the thing a nice background picture.
This is pure dessert topping, no functinal change. Well, eye candy
is important for acceptance. :-)
2015-05-30 18:41:02 +02:00
jbernardis e5e8983427 Configtool: make tooltips for radio buttons work on Linux.
The problem was, applying tooltips to the radio buttons directly
showed no effect on Linux. While this is likely a bug in wxPython,
we can't change this behaviour.

The solution is to also apply these help texts to the surrounding
StaticBox. This works, even for the radio buttons.

This solves issue #149.
2015-05-26 13:49:31 +02:00
jbernardis cbc87fc526 Configtool: align labels and choices vertically.
wxPython apparently doesn't allow to do this automatically,
so do it kind of manually, with a constand in data.py.
--Traumflug
2015-04-21 02:51:30 +02:00
jbernardis 9985c3936d Configtool: many changes.
1) If variables are missing from .h files, they are added.
2) Settings file now modifiable from within the program.
3) A few cosmetic fixes.
2015-04-21 02:11:01 +02:00
jbernardis d6b2a2293e Configtool: incorporate most of previous comments.
See discussion to Issue #111 on Github.
2015-04-21 02:10:58 +02:00
jbernardis d7789ee217 Configtool: major restructuring.
We distinguish between printers and boards now. Most of the
code was split into one file per tab/window and moved into
configtool/.
2015-04-21 02:07:12 +02:00