Skip to content

Commit

Permalink
#3 Finished making the addnew.. combos read only.
Browse files Browse the repository at this point in the history
Last, user must select and existing result before clicking continue to avoid errors
  • Loading branch information
Francisco Arrieta committed Jan 16, 2017
1 parent 7a9c2e3 commit fef01d5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
5 changes: 2 additions & 3 deletions src/wizard/controller/frmAddNewUnitPanel.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
8 changes: 7 additions & 1 deletion src/wizard/controller/frmSeriesDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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,
Expand Down Expand Up @@ -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!'):
Expand Down
3 changes: 1 addition & 2 deletions src/wizard/view/clsAddNewUnitPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
18 changes: 7 additions & 11 deletions src/wizard/view/clsResultPage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 )
Expand Down Expand Up @@ -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 )
Expand All @@ -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 )
Expand Down Expand Up @@ -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 )
Expand Down

0 comments on commit fef01d5

Please sign in to comment.