Ignore:
Timestamp:
Jul 14, 2016 9:00:04 AM (8 years ago)
Author:
lewis
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
de0df2c
Parents:
3331e11
git-author:
Lewis O'Driscoll <lewis.o'driscoll@…> (07/14/16 08:55:32)
git-committer:
Lewis O'Driscoll <lewis.o'driscoll@…> (07/14/16 09:00:04)
Message:

Move detector metadata input to its own window

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/file_converter/converter_widgets.py

    rc9a519f raf84162  
    2525        self.control_name = control_name 
    2626        self._callback = callback 
     27        self._name = control_name 
     28 
    2729        self.labels = labels 
    2830        self.z_enabled = z_enabled 
     
    4042        return self._sizer 
    4143 
     44    def GetName(self): 
     45        return self._name 
     46 
    4247    def GetValue(self): 
    4348        """ 
     
    4853        v = Vector() 
    4954        if not self.Validate(): return v 
    50         for direction, control in self._inputs: 
     55        for direction, control in self._inputs.iteritems(): 
    5156            try: 
    5257                value = float(control.GetValue()) 
     
    5762        return v 
    5863 
     64    def SetValue(self, vector): 
     65        directions = ['x', 'y'] 
     66        if self.z_enabled: directions.append('z') 
     67        for direction in directions: 
     68            value = getattr(vector, direction) 
     69            if value is None: value = '' 
     70            self._inputs[direction].SetValue(str(value)) 
     71 
    5972    def Validate(self): 
    6073        """ 
    6174        Validate the contents of the inputs 
    6275 
    63         :return control_valid: Whether or not the inputs are valid 
    64         :return invalid_control: The control that is not valid 
     76        :return all_valid: Whether or not the inputs are valid 
     77        :return invalid_ctrl: A control that is not valid 
    6578            (or None if all are valid) 
    6679        """ 
     80        all_valid = True 
     81        invalid_ctrl = None 
    6782        for control in self._inputs.values(): 
    6883            if control.GetValue() == '': continue 
     
    7085            control_valid = check_float(control) 
    7186            if not control_valid: 
    72                 return False, control 
    73         return True, None 
     87                all_valid = False 
     88                invalid_ctrl = control 
     89        return all_valid, invalid_ctrl 
    7490 
    7591 
     
    85101        x_input.Bind(wx.EVT_TEXT, self._callback) 
    86102 
    87         self._sizer.AddSpacer((15, -1)) 
     103        self._sizer.AddSpacer((10, -1)) 
    88104 
    89105        y_label = wx.StaticText(self.parent, -1, self.labels[1], 
     
    97113 
    98114        if self.z_enabled: 
    99             self._sizer.AddSpacer((15, -1)) 
     115            self._sizer.AddSpacer((10, -1)) 
    100116 
    101117            z_label = wx.StaticText(self.parent, -1, self.labels[2], 
Note: See TracChangeset for help on using the changeset viewer.