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 __init__(self, paramDict, **kwargs): super(SBTMenu, self).__init__(**kwargs) self.paramDict = paramDict self.app = self.paramDict.get(CONSTS.S_APP) userConf = sutil.getDictFromFile(os.path.join(os.path.dirname(__file__), ".." + os.sep + "conf" + os.sep + "user.ini")) bt_file = userConf.get("BACKTEST_FILE") if bt_file != None and bt_file != "": self.fileList = bt_file.split(",") aflag = False for afile in self.fileList: afilePath = os.path.join(bk_file_dir, afile) if not os.path.exists(afilePath): aflag = True break if not aflag: if self.body_layout != None: self.remove_widget(self.body_layout) refDict = {} for key in self.paramDict.keys(): refDict[key] = self.paramDict[key] refDict["fileDir"] = bk_file_dir refDict["fileList"] = self.fileList refDict[CONSTS.S_BTMENU] = self self.sbacktest = SBacktest(refDict) self.body_layout = self.sbacktest self.body_layout.size_hint = (1, .95) self.body_layout.pos_hint = {'x':0,'y':0} self.add_widget(self.body_layout, index=0) subMenu = self.paramDict.get("SUBMENU") if subMenu != None: if subMenu == False: exitBtn = SButton(text="離開", size_hint=(1, 1)) exitBtn.halign = "center" exitBtn.valign = "middle" exitBtn.bind(on_release=self.closeWindows) self.exitLayout_id.add_widget(exitBtn)