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

Ability to select a container to add widgets to #83

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

Ability to select a container to add widgets to #83

jarvisteach opened this issue Jan 8, 2017 · 7 comments
Assignees
Milestone

Comments

@jarvisteach
Copy link
Owner

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
openContainer now correctly deals with different container types.
@jacobthetechy
Copy link
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
Copy link
Owner Author

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
Copy link
Owner Author

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
Copy link
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
Copy link
Owner Author

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
Copy link
Owner Author

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 self-assigned this Feb 25, 2017
jarvisteach added a commit that referenced this issue Feb 25, 2017
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
Copy link
Owner Author

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
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 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
* 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
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
Projects
None yet
Development

No branches or pull requests

2 participants