Ability to select a container to add widgets to #83

Closed
jarvisteach opened this Issue Jan 8, 2017 · 7 comments

Comments

Projects
None yet
2 participants
@jarvisteach
Owner

jarvisteach commented Jan 8, 2017

Once the GUI is up and running, there is a requirement to dynamically create new widgets.

It's possible to hide/delete existing widgets. But, if widgets are added - they'll be added to the topLevel container at the end (or over the top of existing /removed widgets).

It should be possible to select a container, remove all widgets from it, and add widgets to it.

A simple call - openContainer(type, name) - could be provided to allow widgets to be added to the relevant container.
removeAllWidgets() should then only apply to the current container and its children...

jarvisteach added a commit that referenced this issue Jan 13, 2017

Container type parameterised (#83)
openContainer now correctly deals with different container types.
@jacobthetechy

This comment has been minimized.

Show comment
Hide comment
@jacobthetechy

jacobthetechy Feb 17, 2017

Contributor

Just tested this on version 0.042 and .openLabelFrame() does not put the added widgets into the frame border

Also is it possible to start an empty container, then later use the .openLableFrame()?

Contributor

jacobthetechy commented Feb 17, 2017

Just tested this on version 0.042 and .openLabelFrame() does not put the added widgets into the frame border

Also is it possible to start an empty container, then later use the .openLableFrame()?

@jarvisteach

This comment has been minimized.

Show comment
Hide comment
@jarvisteach

jarvisteach Feb 18, 2017

Owner

As mentioned in issue (#98) the website is out of sync with the release cycle - it's being updated from the development build (next_release branch). This will hopefully be resolved with the next release (0.05) - which is scheduled for the end of the month.

If you want access to the 0.05 features, you can switch to the next_release branch and download the appjar.py file, and replace your existing one...

Owner

jarvisteach commented Feb 18, 2017

As mentioned in issue (#98) the website is out of sync with the release cycle - it's being updated from the development build (next_release branch). This will hopefully be resolved with the next release (0.05) - which is scheduled for the end of the month.

If you want access to the 0.05 features, you can switch to the next_release branch and download the appjar.py file, and replace your existing one...

@jarvisteach

This comment has been minimized.

Show comment
Hide comment
@jarvisteach

jarvisteach Feb 18, 2017

Owner

Currently, it's not possible to create empty containers - as there was no way to reopen them, there was never a use case for this. It does seem that this is something desirable, now that containers can be opened later and modified... I'll raise this as a new feature request.

Owner

jarvisteach commented Feb 18, 2017

Currently, it's not possible to create empty containers - as there was no way to reopen them, there was never a use case for this. It does seem that this is something desirable, now that containers can be opened later and modified... I'll raise this as a new feature request.

@jacobthetechy

This comment has been minimized.

Show comment
Hide comment
@jacobthetechy

jacobthetechy Feb 18, 2017

Contributor

this is the code im testing with for the open container

from appJar import gui

def addFileSettings(bn):
    app.openLabelFrame('Test')
    for s in range(int(app.getEntry('sets'))):
        for o in range(int(app.getSpinBox('set_options'))):
            row = app.getRow()
            app.addLabelOptionBox('Set {} Option {}'.format(s + 1, o + 1),
                                  ['--','OC','HS'], row, 0)
            app.addNumericEntry('set_{}_{}'.format(s, o), row, 1)
            app.setEntryDefault('set_{}_{}'.format(s, o), '.006')
            app.setEntryWidth('set_{}_{}'.format(s, o), 9)
        if s < int(app.getEntry('sets')) - 1:
            app.addHorizontalSeparator(colour = None)
    app.stopLabelFrame()

def addFileSettings2(bn):
    app.startLabelFrame('Test2')
    for s in range(int(app.getEntry('sets'))):
        for o in range(int(app.getSpinBox('set_options'))):
            row = app.getRow()
            app.addLabelOptionBox('2Set {} Option {}'.format(s + 1, o + 1),
                                  ['--','OC','HS'], row, 0)
            app.addNumericEntry('2set_{}_{}'.format(s, o), row, 1)
            app.setEntryDefault('2set_{}_{}'.format(s, o), '.006')
            app.setEntryWidth('2set_{}_{}'.format(s, o), 9)
        if s < int(app.getEntry('sets')) - 1:
            app.addHorizontalSeparator(colour = None)

app=gui()

app.addLabelEntry('sets')
app.startLabelFrame('Test')
row = app.getRow()
app.addLabel('Options', 'Options per Set', row, 0)
app.addSpinBoxRange('set_options', 1, 3, row, 1)
app.setSpinBoxWidth('set_options', 10)
app.stopLabelFrame()

app.addButton('Next', addFileSettings)
app.addButton('Next2', addFileSettings2)
app.go()

Pressing Next2 is what i want to get when pressing next. What am I doing wrong?

and doing pressing Next2 first then Next renders the results I would expect.

Edit: I am using the next_release version

Contributor

jacobthetechy commented Feb 18, 2017

this is the code im testing with for the open container

from appJar import gui

def addFileSettings(bn):
    app.openLabelFrame('Test')
    for s in range(int(app.getEntry('sets'))):
        for o in range(int(app.getSpinBox('set_options'))):
            row = app.getRow()
            app.addLabelOptionBox('Set {} Option {}'.format(s + 1, o + 1),
                                  ['--','OC','HS'], row, 0)
            app.addNumericEntry('set_{}_{}'.format(s, o), row, 1)
            app.setEntryDefault('set_{}_{}'.format(s, o), '.006')
            app.setEntryWidth('set_{}_{}'.format(s, o), 9)
        if s < int(app.getEntry('sets')) - 1:
            app.addHorizontalSeparator(colour = None)
    app.stopLabelFrame()

def addFileSettings2(bn):
    app.startLabelFrame('Test2')
    for s in range(int(app.getEntry('sets'))):
        for o in range(int(app.getSpinBox('set_options'))):
            row = app.getRow()
            app.addLabelOptionBox('2Set {} Option {}'.format(s + 1, o + 1),
                                  ['--','OC','HS'], row, 0)
            app.addNumericEntry('2set_{}_{}'.format(s, o), row, 1)
            app.setEntryDefault('2set_{}_{}'.format(s, o), '.006')
            app.setEntryWidth('2set_{}_{}'.format(s, o), 9)
        if s < int(app.getEntry('sets')) - 1:
            app.addHorizontalSeparator(colour = None)

app=gui()

app.addLabelEntry('sets')
app.startLabelFrame('Test')
row = app.getRow()
app.addLabel('Options', 'Options per Set', row, 0)
app.addSpinBoxRange('set_options', 1, 3, row, 1)
app.setSpinBoxWidth('set_options', 10)
app.stopLabelFrame()

app.addButton('Next', addFileSettings)
app.addButton('Next2', addFileSettings2)
app.go()

Pressing Next2 is what i want to get when pressing next. What am I doing wrong?

and doing pressing Next2 first then Next renders the results I would expect.

Edit: I am using the next_release version

@jarvisteach

This comment has been minimized.

Show comment
Hide comment
@jarvisteach

jarvisteach Feb 25, 2017

Owner

Having a quick look, I think there's a bug in getRow when you open a container. getRow is returning 0 when you open the labelFrame, causing it to overwrite the existing widgets, instead of returning what would have been the nextRow.

If you manage your own row counter your may have more success, initialise it to 0, then add 2 at the beginning of each iteration.

Owner

jarvisteach commented Feb 25, 2017

Having a quick look, I think there's a bug in getRow when you open a container. getRow is returning 0 when you open the labelFrame, causing it to overwrite the existing widgets, instead of returning what would have been the nextRow.

If you manage your own row counter your may have more success, initialise it to 0, then add 2 at the beginning of each iteration.

@jarvisteach

This comment has been minimized.

Show comment
Hide comment
@jarvisteach

jarvisteach Feb 25, 2017

Owner

In fact, all container settings get lost when you reopen a container.
Need to change implementation - cache old container settings.

__removeContainer() should pop the top item, but add it to a cache
__openContainer() will then reload the cached dictionary and add it back to the stack

Owner

jarvisteach commented Feb 25, 2017

In fact, all container settings get lost when you reopen a container.
Need to change implementation - cache old container settings.

__removeContainer() should pop the top item, but add it to a cache
__openContainer() will then reload the cached dictionary and add it back to the stack

@jarvisteach jarvisteach added the bug label Feb 25, 2017

@jarvisteach jarvisteach self-assigned this Feb 25, 2017

jarvisteach added a commit that referenced this issue Feb 25, 2017

Fixed bug in #83
Container config options weren’t being kept. Now, when you open a
container, the old config is used. This keeps row counts, sticky,
padding settings consistent.

Added dictionary of usedConfigs with type__title as a key

When a container is closed, the config is added to this dictionary.

When a container is opened again, the config is loaded from this
dictionary.
@jarvisteach

This comment has been minimized.

Show comment
Hide comment
@jarvisteach

jarvisteach Feb 25, 2017

Owner

Have updated next_release to retain config options.

Owner

jarvisteach commented Feb 25, 2017

Have updated next_release to retain config options.

@jarvisteach jarvisteach modified the milestone: 0.05 Feb 25, 2017

jarvisteach added a commit that referenced this issue Mar 11, 2017

Hide/Show Toolbar (#83)
Start on work to allow toolbar to be hidden/shown when mouse goes over.

Involves having a second label - just a few pixels tall. When the mouse
goes over it - hide it & show the toolbar.

When the mouse leaves the toolbar - hide it & show the label.

Includes a function to ```setToolbarPinned()``` to turn it on/off.

Now needs an icon (drawing pin) to place in toolbar to call the pin
function/show pin status.

jarvisteach added a commit that referenced this issue Apr 29, 2017

Added icon to toggle/reflect pin status (#83)
Added icons (50% size of originals, and show them in toolbar
Clicking the icon will toggle the pin state, and  in turn change the
icon

jarvisteach added a commit that referenced this issue Apr 30, 2017

final updates to tb (#83)
* added basic tooltip - need to merge into next_release so we can
change it easily on toggle
* changed way it functions - tbs default to no pin, user has to call
`.setToolbarPinned()` to turn it on and give the top an initial pinned
status
* changed `.__dimensionWindow()` it now makes sure the toolbar is
showing before setting minimum size

A couple of things to think about:
* should be possible to remove the pin, after it’s added
* hiding the toolbar causes the window to shrink - maybe not ideal…

jarvisteach added a commit that referenced this issue Apr 30, 2017

Merging toolbar branch into next_release (#83)
Trying to get all feature branches merged into one

jarvisteach added a commit that referenced this issue Apr 30, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment