diff --git a/src/wizard/controller/frmAddNewUnitPanel.py b/src/wizard/controller/frmAddNewUnitPanel.py index ae4d5b9..7072b14 100644 --- a/src/wizard/controller/frmAddNewUnitPanel.py +++ b/src/wizard/controller/frmAddNewUnitPanel.py @@ -1,13 +1,12 @@ - import wx from src.wizard.view.clsAddNewUnitPanel import AddNewUnitPanelView from odm2api.ODM2.models import Units + class AddNewUnitPanelController(AddNewUnitPanelView): def __init__(self, daddy, db, **kwargs): - super(AddNewUnitPanelController, self).__init__(daddy, - **kwargs) + super(AddNewUnitPanelController, self).__init__(daddy, **kwargs) self.parent = daddy self.db = db diff --git a/src/wizard/controller/frmSeriesDialog.py b/src/wizard/controller/frmSeriesDialog.py index 592f523..18a02be 100644 --- a/src/wizard/controller/frmSeriesDialog.py +++ b/src/wizard/controller/frmSeriesDialog.py @@ -37,6 +37,7 @@ def __init__(self, parent, variable, database): #read.getDetailedResultInfo("Time series coverage") self.seriesSelectPanel = SeriesSelectPanelView(self) self.addPanel(self.seriesSelectPanel) + self.seriesSelectPanel.okBtn.Disable() self.seriesSelectPanel.newBtn.Bind(wx.EVT_BUTTON, self.onNew) self.seriesSelectPanel.editBtn.Bind(wx.EVT_BUTTON, self.onEdit) @@ -45,11 +46,15 @@ def __init__(self, parent, variable, database): self.seriesSelectPanel.listCtrl.SetObjects(read.getDetailedResultInfo("Time series coverage")) self.seriesSelectPanel.listCtrl.Bind(wx.EVT_LIST_ITEM_SELECTED, self.enable) + self.seriesSelectPanel.listCtrl.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.on_deselect_item) # ================== # # > Event Handlers < # # ================== # + def on_deselect_item(self, event): + self.seriesSelectPanel.okBtn.Disable() + def onNew(self, event): wiz = WizardDialog(self, database=self.database, @@ -86,7 +91,8 @@ def onNew(self, event): event.Skip() def enable(self, event): - self.seriesSelectPanel.editBtn.Enable(True) + self.seriesSelectPanel.editBtn.Enable() + self.seriesSelectPanel.okBtn.Enable() self.existingResult = self.seriesSelectPanel.listCtrl.GetSelectedObject() def Warning(parent, message, caption ='Warning!'): diff --git a/src/wizard/view/clsAddNewUnitPanel.py b/src/wizard/view/clsAddNewUnitPanel.py index b6cc5e6..da3ed57 100644 --- a/src/wizard/view/clsAddNewUnitPanel.py +++ b/src/wizard/view/clsAddNewUnitPanel.py @@ -38,8 +38,7 @@ def __init__( self, parent ): bSizer35.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) - m_comboBox13Choices = [] - self.m_comboBox13 = wx.ComboBox( sbSizer7.GetStaticBox(), wx.ID_ANY, u"Select Units Type", wx.DefaultPosition, wx.DefaultSize, m_comboBox13Choices, validator=RequiredComboValidator()) + self.m_comboBox13 = wx.ComboBox(sbSizer7.GetStaticBox(), wx.ID_ANY, u"Select Units Type", style=wx.CB_READONLY, validator=RequiredComboValidator()) self.m_comboBox13.SetMinSize( wx.Size( 280,-1 ) ) bSizer35.Add( self.m_comboBox13, 0, wx.ALL, 5 ) diff --git a/src/wizard/view/clsResultPage.py b/src/wizard/view/clsResultPage.py index 8b12ce4..984355c 100644 --- a/src/wizard/view/clsResultPage.py +++ b/src/wizard/view/clsResultPage.py @@ -42,8 +42,7 @@ def __init__( self, parent ): bSizerSamp.AddSpacer((0, 0), 1, wx.EXPAND, 5) - comboSampChoices = [] - self.comboSamp = wx.ComboBox( sbSizerReq.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, comboSampChoices, validator=RequiredComboValidator()) + self.comboSamp = wx.ComboBox( sbSizerReq.GetStaticBox(), style=wx.CB_READONLY, validator=RequiredComboValidator()) self.comboSamp.SetMinSize(wx.Size(280, -1)) bSizerSamp.Add(self.comboSamp, 0, wx.ALL, 5) @@ -57,8 +56,7 @@ def __init__( self, parent ): bSizerAgg.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) - comboAggChoices = [] - self.comboAgg = wx.ComboBox( sbSizerReq.GetStaticBox(), wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, comboAggChoices, validator=RequiredComboValidator()) + self.comboAgg = wx.ComboBox( sbSizerReq.GetStaticBox(), wx.ID_ANY, style=wx.CB_READONLY, validator=RequiredComboValidator()) self.comboAgg.SetMinSize( wx.Size( 280,-1 ) ) bSizerAgg.Add( self.comboAgg, 0, wx.ALL, 5 ) @@ -176,8 +174,7 @@ def __init__( self, parent ): bSizerStatus.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) - comboStatusChoices = [] - self.comboStatus = wx.ComboBox( sbSizerOpt.GetStaticBox(), wx.ID_ANY, u"Select Status", wx.DefaultPosition, wx.DefaultSize, comboStatusChoices, 0 ) + self.comboStatus = wx.ComboBox( sbSizerOpt.GetStaticBox(), wx.ID_ANY, value="Select Status", style=wx.CB_READONLY) self.comboStatus.SetMinSize( wx.Size( 280,-1 ) ) bSizerStatus.Add( self.comboStatus, 0, wx.ALL, 5 ) @@ -187,15 +184,14 @@ def __init__( self, parent ): bSizerTax = wx.BoxSizer( wx.HORIZONTAL ) - staticTax = wx.StaticText( sbSizerOpt.GetStaticBox(), wx.ID_ANY, u"Taxonomic Classifier", wx.DefaultPosition, wx.DefaultSize, 0 ) - staticTax.Wrap( -1 ) + staticTax = wx.StaticText( sbSizerOpt.GetStaticBox(), wx.ID_ANY, u"Taxonomic Classifier", wx.DefaultPosition, wx.DefaultSize, 0) + staticTax.Wrap(-1) bSizerTax.Add( staticTax, 0, wx.ALL, 5 ) bSizerTax.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) - comboTaxChoices = [] - self.comboTax = wx.ComboBox( sbSizerOpt.GetStaticBox(), wx.ID_ANY, u"Select Taxonomic Classifier", wx.DefaultPosition, wx.DefaultSize, comboTaxChoices, 0 ) + self.comboTax = wx.ComboBox( sbSizerOpt.GetStaticBox(), wx.ID_ANY, value="Select Taxonomic Classifier", style=wx.CB_READONLY) self.comboTax.SetMinSize( wx.Size( 280,-1 ) ) bSizerTax.Add( self.comboTax, 0, wx.ALL, 5 ) @@ -306,7 +302,7 @@ def __init__( self, parent ): self.txtZ.SetFormat("%f") self.txtZ.SetDigits(3) self.txtZ.SetMinSize( wx.Size( 70,-1 ) ) - + bSizerZ.Add( self.txtZ, 0, wx.ALL, 5 ) self.m_staticText422110 = wx.StaticText( sbSizerOpt.GetStaticBox(), wx.ID_ANY, u"Units", wx.DefaultPosition, wx.DefaultSize, 0 )