Datetime Trait?

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

Datetime Trait?

Fabio Pliger
Hi all,

If i'm not wrong, right now there's no DateTime type supported on Traits ( only Date and Time ). Is it planned to add a Datetime ( and datetime_editor.. ) type support on Traits anytime soon? ( or maybe it's already supported and i'm just too dumb and haven't noticed it :) )

Probably i'm going to need it and before writing useless code i'd like to be sure its really necessary...

thanks in advance

Fabio

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

Re: Datetime Trait?

Brad Buran
I can't speak for the developers (I'm just a user of the package), but
I can say (from experience with other frameworks) that creating a
datetime editor is not really a straightforward task.  You typically
need two fields, each with the associated widget (e.g. a date picker
and a time picker), then you need to add some glue somewhere in your
code to merge these two fields into a DateTime field.  For example,
try the following pseudocode:

class Schedule(HasTraits):
   date = Date
   time = Time
   datetime = Property(Instance(DateTime))

   def _get_datetime(self):
        # the appropriate code to merge the date and time fields into
a single datetime field goes here

   trait_view = View('date', 'time')

On 7/26/10, Fabio Pliger <[hidden email]> wrote:

> Hi all,
>
> If i'm not wrong, right now there's no DateTime type supported on Traits (
> only Date and Time ). Is it planned to add a Datetime ( and
> datetime_editor.. ) type support on Traits anytime soon? ( or maybe it's
> already supported and i'm just too dumb and haven't noticed it :) )
>
> Probably i'm going to need it and before writing useless code i'd like to be
> sure its really necessary...
>
> thanks in advance
>
> Fabio
>
> _______________________________________________
>  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
Reply | Threaded
Open this post in threaded view
|

Re: Datetime Trait?

Fabio Pliger
In reply to this post by Fabio Pliger

Yeap, i've already tried a similar solution but it's a way to avoid the problem. What i'd like to do is receive some table columns and depending on the column type id' like to create a gui to handle it. The Property approach is my last bullet.. creating a new Datetime trait type seemed much more "the right thing to do" to me, but maybe i'm wrong and doing requires much more work and effort to do... Opinions about this?



I can't speak for the developers (I'm just a user of the package), but
I can say (from experience with other frameworks) that creating a
datetime editor is not really a straightforward task. You typically
need two fields, each with the associated widget (e.g. a date picker
and a time picker), then you need to add some glue somewhere in your
code to merge these two fields into a DateTime field. For example,
try the following pseudocode:

class Schedule(HasTraits):
date = Date
time = Time
datetime = Property(Instance(DateTime))

def _get_datetime(self):
# the appropriate code to merge the date and time fields into
a single datetime field goes here

trait_view = View('date', 'time')

2010/7/26 Fabio Pliger <[hidden email]>
Hi all,

If i'm not wrong, right now there's no DateTime type supported on Traits ( only Date and Time ). Is it planned to add a Datetime ( and datetime_editor.. ) type support on Traits anytime soon? ( or maybe it's already supported and i'm just too dumb and haven't noticed it :) )

Probably i'm going to need it and before writing useless code i'd like to be sure its really necessary...

thanks in advance

Fabio



--
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction.

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