@@ -55,20 +55,19 @@ def variable_description(var, skip_attributes=False):
5555 var .name ,
5656 (("values" , tuple (var .values )),),
5757 attributes )
58+ elif var .is_time :
59+ return (var_type .__module__ ,
60+ var_type .__name__ ,
61+ var .name ,
62+ (("have_date" , var .have_date ),
63+ ("have_time" , var .have_time )),
64+ attributes )
5865 else :
59- if var .is_time :
60- return (var_type .__module__ ,
61- var_type .__name__ ,
62- var .name ,
63- (("have_date" , var .have_date ),
64- ("have_time" , var .have_time )),
65- attributes )
66- else :
67- return (var_type .__module__ ,
68- var_type .__name__ ,
69- var .name ,
70- (),
71- attributes )
66+ return (var_type .__module__ ,
67+ var_type .__name__ ,
68+ var .name ,
69+ (),
70+ attributes )
7271
7372
7473def variable_from_description (description , compute_value = None ):
@@ -83,12 +82,8 @@ def variable_from_description(description, compute_value=None):
8382 raise ValueError ("Invalid descriptor type '{}.{}"
8483 "" .format (module , type_name ))
8584
86- kwargs = dict (list (args ))
87- var = constructor (name , compute_value = compute_value , ** kwargs )
85+ var = constructor (name , compute_value = compute_value , ** dict (list (args )))
8886 var .attributes .update (attrs )
89- if var .is_time :
90- var .have_date = kwargs ['have_date' ]
91- var .have_time = kwargs ['have_time' ]
9287 return var
9388
9489
@@ -449,8 +444,8 @@ def __init__(self):
449444 self .editor_stack = QStackedWidget ()
450445
451446 self .editor_stack .addWidget (DiscreteVariableEditor ())
452- self .editor_stack .addWidget (TimeVariableEditor ())
453447 self .editor_stack .addWidget (ContinuousVariableEditor ())
448+ self .editor_stack .addWidget (TimeVariableEditor ())
454449 self .editor_stack .addWidget (VariableEditor ())
455450
456451 box .layout ().addWidget (self .editor_stack )
@@ -549,10 +544,11 @@ def open_editor(self, index):
549544 editor_index = 3
550545 if var .is_discrete :
551546 editor_index = 0
547+ # TimeVariable is also continuous, first check if time
552548 elif var .is_time :
553- editor_index = 1
554- elif var .is_continuous :
555549 editor_index = 2
550+ elif var .is_continuous :
551+ editor_index = 1
556552 editor = self .editor_stack .widget (editor_index )
557553 self .editor_stack .setCurrentWidget (editor )
558554
0 commit comments