Kaydet (Commit) 949facec authored tarafından Xisco Fauli's avatar Xisco Fauli

pyagenda: Update topics's gui when launching the wizard

Change-Id: Ifb38b49fb62d5fc85bcc6dfa7729bb87d3c7f8e0
üst 57954fdd
...@@ -103,7 +103,10 @@ class TopicsControl(ControlScroller): ...@@ -103,7 +103,10 @@ class TopicsControl(ControlScroller):
super(TopicsControl, self).__init__( super(TopicsControl, self).__init__(
dialog, xmsf, 5, 92, 38, 212, 5, 18, HID + 32) dialog, xmsf, 5, 92, 38, 212, 5, 18, HID + 32)
self.dialog = dialog self.dialog = dialog
#fill preview's table
self.initializeScrollFields(agenda) self.initializeScrollFields(agenda)
#fill gui's table
self.fillupControls(True)
self.nscrollvalue = 0 self.nscrollvalue = 0
self.lastFocusRow = 0 self.lastFocusRow = 0
self.lastFocusControl = None self.lastFocusControl = None
...@@ -314,9 +317,6 @@ class TopicsControl(ControlScroller): ...@@ -314,9 +317,6 @@ class TopicsControl(ControlScroller):
Implementation of ControlScroller Implementation of ControlScroller
This is a UI method which inserts a new row to the control. This is a UI method which inserts a new row to the control.
It uses the child-class ControlRow. (see below). It uses the child-class ControlRow. (see below).
@param _index
@param npos
@see ControlRow
''' '''
def insertControlGroup(self, _index, npos): def insertControlGroup(self, _index, npos):
......
...@@ -33,6 +33,7 @@ class ControlScroller(object): ...@@ -33,6 +33,7 @@ class ControlScroller(object):
_iCompWidth, _nblockincrement, _nlinedistance, _firsthelpindex): _iCompWidth, _nblockincrement, _nlinedistance, _firsthelpindex):
self.xMSF = _xMSF self.xMSF = _xMSF
self.scrollfields = [] self.scrollfields = []
self.ControlGroupVector = []
ControlScroller.nblockincrement = _nblockincrement ControlScroller.nblockincrement = _nblockincrement
self.CurUnoDialog = _CurUnoDialog self.CurUnoDialog = _CurUnoDialog
self.iStep = _iStep self.iStep = _iStep
...@@ -50,7 +51,7 @@ class ControlScroller(object): ...@@ -50,7 +51,7 @@ class ControlScroller(object):
self.sincSuffix = Desktop.getIncrementSuffix( self.sincSuffix = Desktop.getIncrementSuffix(
self.CurUnoDialog.xDialogModel, "imgBackground") self.CurUnoDialog.xDialogModel, "imgBackground")
ControlScroller.xScrollBar = self.CurUnoDialog.insertScrollBar( self.xScrollBar = self.CurUnoDialog.insertScrollBar(
"TitleScrollBar" + self.sincSuffix, "TitleScrollBar" + self.sincSuffix,
("Border", PropertyNames.PROPERTY_ENABLED, ("Border", PropertyNames.PROPERTY_ENABLED,
PropertyNames.PROPERTY_HEIGHT, PropertyNames.PROPERTY_HEIGHT,
...@@ -65,13 +66,12 @@ class ControlScroller(object): ...@@ -65,13 +66,12 @@ class ControlScroller(object):
ControlScroller.iScrollBarWidth - 1, ControlScroller.iScrollBarWidth - 1,
self.iCompPosY + 1, self.iStep, self.iCompPosY + 1, self.iStep,
ControlScroller.iScrollBarWidth), 0, self) ControlScroller.iScrollBarWidth), 0, self)
ControlScroller.nscrollvalue = 0 self.nscrollvalue = 0
ControlScroller.ControlGroupVector = []
ypos = self.iStartPosY + ControlScroller.SORELFIRSTPOSY ypos = self.iStartPosY + ControlScroller.SORELFIRSTPOSY
for i in range(ControlScroller.nblockincrement): for i in range(ControlScroller.nblockincrement):
self.insertControlGroup(i, ypos) self.insertControlGroup(i, ypos)
ypos += self.linedistance ypos += self.linedistance
def fillupControls(self, binitialize): def fillupControls(self, binitialize):
for i in range(ControlScroller.nblockincrement): for i in range(ControlScroller.nblockincrement):
if i < self.ncurfieldcount: if i < self.ncurfieldcount:
...@@ -79,21 +79,23 @@ class ControlScroller(object): ...@@ -79,21 +79,23 @@ class ControlScroller(object):
if binitialize: if binitialize:
self.CurUnoDialog.repaintDialogStep() self.CurUnoDialog.repaintDialogStep()
def fillupControl(self, guiRow): def fillupControl(self, guiRow):
nameProps = self.scrollfields[guiRow] nameProps = self.scrollfields[guiRow]
valueProps = self.scrollfields[guiRow + ControlScroller.nscrollvalue] valueProps = self.scrollfields[guiRow + self.nscrollvalue]
for index, item in enumerate(nameProps): for index, item in enumerate(nameProps):
if self.CurUnoDialog.xDialogModel.hasByName(item.Name): if self.CurUnoDialog.xDialogModel.hasByName(item.Name):
self.setControlData(item.Name, valueProps[index].Value) self.setControlData(item.Name, valueProps[index].Value)
else: else:
raise AttributeError("No such control !") raise AttributeError("No such control !")
self.ControlGroupVector[guiRow].setEnabled(True)
def setScrollValue(self, _nscrollvalue, _ntotfieldcount=None): def setScrollValue(self, _nscrollvalue, _ntotfieldcount=None):
if _ntotfieldcount is not None: if _ntotfieldcount is not None:
self.setTotalFieldCount(_ntotfieldcount) self.setTotalFieldCount(_ntotfieldcount)
if _nscrollvalue >= 0: if _nscrollvalue >= 0:
ControlScroller.xScrollBar.Model.ScrollValue = _nscrollvalue self.xScrollBar.Model.ScrollValue = _nscrollvalue
self.scrollControls() self.scrollControls()
def setCurFieldCount(self): def setCurFieldCount(self):
...@@ -106,11 +108,11 @@ class ControlScroller(object): ...@@ -106,11 +108,11 @@ class ControlScroller(object):
self.ntotfieldcount = _ntotfieldcount self.ntotfieldcount = _ntotfieldcount
self.setCurFieldCount() self.setCurFieldCount()
if self.ntotfieldcount > ControlScroller.nblockincrement: if self.ntotfieldcount > ControlScroller.nblockincrement:
ControlScroller.xScrollBar.Model.Enabled = True self.xScrollBar.Model.Enabled = True
ControlScroller.xScrollBar.Model.ScrollValueMax = \ self.xScrollBar.Model.ScrollValueMax = \
self.ntotfieldcount - ControlScroller.nblockincrement self.ntotfieldcount - ControlScroller.nblockincrement
else: else:
ControlScroller.xScrollBar.Model.Enabled = False self.xScrollBar.Model.Enabled = False
def toggleComponent(self, _bdoenable): def toggleComponent(self, _bdoenable):
bdoenable = _bdoenable and \ bdoenable = _bdoenable and \
...@@ -132,11 +134,11 @@ class ControlScroller(object): ...@@ -132,11 +134,11 @@ class ControlScroller(object):
def scrollControls(self): def scrollControls(self):
try: try:
ControlScroller.nscrollvalue = \ self.nscrollvalue = \
int(ControlScroller.xScrollBar.Model.ScrollValue) int(self.xScrollBar.Model.ScrollValue)
if ControlScroller.nscrollvalue + ControlScroller.nblockincrement \ if self.nscrollvalue + ControlScroller.nblockincrement \
>= self.ntotfieldcount: >= self.ntotfieldcount:
ControlScroller.nscrollvalue = \ self.nscrollvalue = \
self.ntotfieldcount - ControlScroller.nblockincrement self.ntotfieldcount - ControlScroller.nblockincrement
self.fillupControls(False) self.fillupControls(False)
except Exception: except Exception:
...@@ -152,8 +154,8 @@ class ControlScroller(object): ...@@ -152,8 +154,8 @@ class ControlScroller(object):
''' '''
def fieldInfo(self, guiRow, column): def fieldInfo(self, guiRow, column):
if guiRow + ControlScroller.nscrollvalue < len(self.scrollfields): if guiRow + self.nscrollvalue < len(self.scrollfields):
valueProp = (self.scrollfields[guiRow + ControlScroller.nscrollvalue])[column] valueProp = (self.scrollfields[guiRow + self.nscrollvalue])[column]
nameProp = (self.scrollfields[guiRow])[column] nameProp = (self.scrollfields[guiRow])[column]
if self.CurUnoDialog.xDialogModel.hasByName(nameProp.Name): if self.CurUnoDialog.xDialogModel.hasByName(nameProp.Name):
valueProp.Value = self.getControlData(nameProp.Name) valueProp.Value = self.getControlData(nameProp.Name)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment