[traits][traitsui] No history in File and FileEditor

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[traits][traitsui] No history in File and FileEditor

Michael Aye
Hi,

Is there a flag I need to be setting somewhere so that the File-Dialog
can save its history?

In the below 2 different used codes I tried to make the history work,
in both cases I can use the browse tree from the […] button to pick a
file, after having done so, the history button next to it correctly has
the previously selected path.
But closing the app and restarting it does not remember anything. (I
believe in spec it should do so?) I do launch the app in a folder that
is writable by me.

Version1:

from traits.api \
    import HasTraits, File
from traitsui.api \
    import Item, View, FileEditor

class DivGui ( HasTraits ):
    fpath = File
    view1 = View(
        Item('fpath',editor=FileEditor(entries=10))
        )

# Create the GUI:
gui = DivGui()

# Run the GUI (if invoked from the command line):
if __name__ == '__main__':
    gui.configure_traits()


Version2:


from traits.api \
    import HasTraits, File
from traitsui.api \
    import Item, View

class DivGui ( HasTraits ):
    fpath = File(entries=10)
    view1 = View(
        Item('fpath')
        )

# Create the GUI:
gui = DivGui()

# Run the GUI (if invoked from the command line):
if __name__ == '__main__':
    gui.configure_traits()


Coincidently, I have currently this Stackoverflow question running,
asking how to decide which version to use when?
http://stackoverflow.com/questions/13127994/use-trait-options-or-traitui-editor-factory-options 


Best regards, and  as always:
Thanks for providing TraitsUI to scientists. It makes the world a
better place. Seriously! ;)

Michael

PS.: Almost forgot, my setup:

()[maye@lunatic ~]$ ipython
Python 2.7.3 |EPD 7.3-2 (32-bit)| (default, Apr 12 2012, 11:28:34)
Type "copyright", "credits" or "license" for more information.

IPython 0.13.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import traits

In [2]: traits.__version__
Out[2]: '4.2.0'

In [3]: import traitsui

In [4]: traitsui.__version__
Out[4]: '4.2.0'

on a Mac running 10.8.2


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: [traits][traitsui] No history in File and FileEditor

Michael Aye
Additionally, I just discovered an inconsistency in the interpretation
of the filter list:

When not using the 'entries' option for the history, the filter
accepted by the File trait can look like this:

filter=['h5','tab','TAB']

and it (correctly? in spec?) greys out all files in the standard file
browser not having an extension from the list.

When using the 'entries' option though, the filter list has to look like this:

filter=['*.tab','*.TAB','*.h5']

otherwise, no files are being displayed in the file tree browser that
pops up using the […] button.

Here is the full example where you can try to change the filter and/or
include/exclude the option 'entries' from the fpath trait to see all 4
behaviors.


from traits.api \
    import HasTraits, File
from traitsui.api \
    import Item, View

class DivGui ( HasTraits ):

    fpath = File('/Users/maye/data/diviner/', entries=10,
                filter=['h5','tab','TAB'])
    view1 = View(
        Item('fpath', label='Inputfile'),
    )

# Create the GUI:
gui = DivGui()

# Run the GUI (if invoked from the command line):
if __name__ == '__main__':
    gui.configure_traits()


On 2012-10-30 02:44:14 +0000, Michael Aye said:

> Hi,
>
> Is there a flag I need to be setting somewhere so that the File-Dialog
> can save its history?
>
> In the below 2 different used codes I tried to make the history work,
> in both cases I can use the browse tree from the […] button to pick a
> file, after having done so, the history button next to it correctly has
> the previously selected path.
> But closing the app and restarting it does not remember anything. (I
> believe in spec it should do so?) I do launch the app in a folder that
> is writable by me.
>
> Version1:
>
> from traits.api \
>     import HasTraits, File
> from traitsui.api \
>     import Item, View, FileEditor
>
> class DivGui ( HasTraits ):
>     fpath = File
>     view1 = View(
>         Item('fpath',editor=FileEditor(entries=10))
>         )
>
> # Create the GUI:
> gui = DivGui()
>
> # Run the GUI (if invoked from the command line):
> if __name__ == '__main__':
>     gui.configure_traits()
>
>
> Version2:
>
>
> from traits.api \
>     import HasTraits, File
> from traitsui.api \
>     import Item, View
>
> class DivGui ( HasTraits ):
>     fpath = File(entries=10)
>     view1 = View(
>         Item('fpath')
>         )
>
> # Create the GUI:
> gui = DivGui()
>
> # Run the GUI (if invoked from the command line):
> if __name__ == '__main__':
>     gui.configure_traits()
>
>
> Coincidently, I have currently this Stackoverflow question running,
> asking how to decide which version to use when?
> http://stackoverflow.com/questions/13127994/use-trait-options-or-traitui-editor-factory-options 
>
>
>
> Best regards, and  as always:
> Thanks for providing TraitsUI to scientists. It makes the world a
> better place. Seriously! ;)
>
> Michael
>
> PS.: Almost forgot, my setup:
>
> ()[maye@lunatic ~]$ ipython
> Python 2.7.3 |EPD 7.3-2 (32-bit)| (default, Apr 12 2012, 11:28:34)
> Type "copyright", "credits" or "license" for more information.
>
> IPython 0.13.1 -- An enhanced Interactive Python.
> ?         -> Introduction and overview of IPython's features.
> %quickref -> Quick reference.
> help      -> Python's own help system.
> object?   -> Details about 'object', use 'object??' for extra details.
>
> In [1]: import traits
>
> In [2]: traits.__version__
> Out[2]: '4.2.0'
>
> In [3]: import traitsui
>
> In [4]: traitsui.__version__
> Out[4]: '4.2.0'
>
> on a Mac running 10.8.2
>
>
> _______________________________________________
> Enthought-Dev mailing list
> [hidden email]
> https://mail.enthought.com/mailman/listinfo/enthought-dev



_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev