def addInsertRow(self, strIndex): rowList = [] funcLayout = SBoxLayout(size_hint=(.15, None), height=30) funcLayout.orientation = "horizontal" funcLayout.padding = (1, 1, 1, 1) funcLayout.add_widget(BoxLayout(size_hint=(.1, 1))) btn = SButton(text="新增", size_hint=(.8, 1)) btn.halign = "center" btn.valign = "middle" btn.bind(on_release=self.addRecordPopup) funcLayout.add_widget(btn) funcLayout.add_widget(BoxLayout(size_hint=(.1, 1))) rowList.append(funcLayout) self.contentLayout.add_widget(funcLayout) contentLabel = SContentLabel(text="", size_hint=(.4, None), height=30) contentLabel.halign = "left" contentLabel.valign = "middle" rowList.append(contentLabel) self.contentLayout.add_widget(contentLabel) contentLabel = SContentLabel(text="", size_hint=(.25, None), height=30) contentLabel.halign = "right" contentLabel.valign = "middle" rowList.append(contentLabel) self.contentLayout.add_widget(contentLabel) contentLabel = SContentLabel(text="", size_hint=(.2, None), height=30) contentLabel.halign = "right" contentLabel.valign = "middle" rowList.append(contentLabel) self.contentLayout.add_widget(contentLabel) self.def_ids[int(strIndex)] = rowList
def addListRow(self, alist): rowList = [] funcLayout = SBoxLayout(size_hint=(.15, None), height=30) funcLayout.orientation = "horizontal" funcLayout.padding = (1, 1, 1, 1) funcLayout.add_widget(BoxLayout(size_hint=(.1, 1))) btn = SInfoButton(extra_info=alist[0], text="刪", size_hint=(.8, 1)) btn.halign = "center" btn.valign = "middle" btn.bind(on_release=self.deleteRecordPopup) funcLayout.add_widget(btn) funcLayout.add_widget(BoxLayout(size_hint=(.1, 1))) rowList.append(funcLayout) self.contentLayout.add_widget(funcLayout) contentLabel = SContentLabel(text=alist[0][2:], size_hint=(.2, None), height=30) contentLabel.color = colorHex("#000000") contentLabel.halign = "center" contentLabel.valign = "middle" rowList.append(contentLabel) self.contentLayout.add_widget(contentLabel) contentLabel = SContentLabel(text=alist[1], size_hint=(.65, None), height=30) contentLabel.color = colorHex("#000000") contentLabel.halign = "left" contentLabel.valign = "middle" rowList.append(contentLabel) self.contentLayout.add_widget(contentLabel) self.def_ids[alist[0]] = rowList
def addListRow(self, alist, aflag): if aflag: self.deleteRow(self.maxIndex) rowList = [] funcLayout = SBoxLayout(size_hint=(.15, None), height=30) funcLayout.orientation = "horizontal" funcLayout.padding = (1, 1, 1, 1) funcLayout.add_widget(BoxLayout(size_hint=(.09, 1))) btn = SInfoButton(extra_info=self.maxIndex, text="修", size_hint=(.4, 1)) btn.halign = "center" btn.valign = "middle" btn.bind(on_release=self.updateRecordPopup) funcLayout.add_widget(btn) funcLayout.add_widget(BoxLayout(size_hint=(.02, 1))) btn = SInfoButton(extra_info=self.maxIndex, text="刪", size_hint=(.4, 1)) btn.halign = "center" btn.valign = "middle" btn.bind(on_release=self.deleteRecordPopup) if alist[0] == "證券普通股" or alist[0] == "台指期貨": btn.disabled = True funcLayout.add_widget(btn) funcLayout.add_widget(BoxLayout(size_hint=(.09, 1))) rowList.append(funcLayout) self.contentLayout.add_widget(funcLayout) contentLabel = SContentLabel(text=alist[0], size_hint=(.4, None), height=30) contentLabel.color = colorHex("#000000") contentLabel.halign = "left" contentLabel.valign = "middle" rowList.append(contentLabel) self.contentLayout.add_widget(contentLabel) contentLabel = SContentLabel(text=alist[1], size_hint=(.25, None), height=30) contentLabel.color = colorHex("#000000") contentLabel.halign = "right" contentLabel.valign = "middle" rowList.append(contentLabel) self.contentLayout.add_widget(contentLabel) contentLabel = SContentLabel(text=alist[2], size_hint=(.2, None), height=30) contentLabel.color = colorHex("#000000") contentLabel.halign = "right" contentLabel.valign = "middle" rowList.append(contentLabel) self.contentLayout.add_widget(contentLabel) self.def_ids[self.maxIndex] = rowList
def _addContentData(self): self.gridLayout.clear_widgets() startIdx = (self.page_num - 1) * NUM_PER_PAGE endIdx = self.page_num * NUM_PER_PAGE if endIdx > len(self.resultIdNameList): endIdx = len(self.resultIdNameList) idNameList = None refParam = None for aIdx in range(startIdx, endIdx): idNameList = self.resultIdNameList[aIdx] funcLayout = SBoxLayout(size_hint=(.15, None), height=30) funcLayout.orientation = "horizontal" funcLayout.padding = (1, 1, 1, 1) funcLayout.add_widget(BoxLayout(size_hint=(.1, 1))) refParam = {} refParam["idNameList"] = idNameList acbObj = SCheckBox(refParam) acbObj.size_hint = (1, 1) if idNameList[0] in self.selectDict: acbObj.active = True else: acbObj.active = False acbObj.bind(active=self._on_checkbox_active) funcLayout.add_widget(acbObj) funcLayout.add_widget(BoxLayout(size_hint=(.1, 1))) self.gridLayout.add_widget(funcLayout) contentLabel = SContentLabel(text=idNameList[0][2:], size_hint=(.2, None), height=30) contentLabel.color = colorHex("#000000") contentLabel.halign = "center" contentLabel.valign = "middle" self.gridLayout.add_widget(contentLabel) contentLabel = SContentLabel(text=idNameList[1], size_hint=(.65, None), height=30) contentLabel.color = colorHex("#000000") contentLabel.halign = "left" contentLabel.valign = "middle" self.gridLayout.add_widget(contentLabel)
def _addStockData(self): self.contentLayout.clear_widgets() dataFields = self.result.get("DataFields") headNum = len(dataFields) for aData in self.currStockDataList: if aData == "": continue aFieldList = aData.split("|") num = -1 for aField in aFieldList: if aField == "": continue num += 1 contentLabel = SContentLabel(size_hint=(1.0 / headNum, None), height=30) contentLabel.color = colorHex("#000000") if dataFields[num] == "ID" or dataFields[num] == "NAME": contentLabel.text = aField contentLabel.halign = "center" else: contentLabel.text = "{:.2f}".format(float(aField)) contentLabel.halign = "right" contentLabel.valign = "middle" self.contentLayout.add_widget(contentLabel)