def showExplain(self): filePath = os.path.join(os.path.dirname(__file__), "../conf/explain.ini") with open(filePath, 'r', encoding='utf-8-sig') as f: lineList = f.readlines() explainStr = "" for astr in lineList: explainStr += astr contentLayout = STableBoxLayout(size_hint=(1, 1), orientation="vertical") slview = STableScrollView(size_hint=(1, .92)) contentLayout.add_widget(slview) explainLayout = STableBoxLayout(size_hint=(1, None)) explainLayout.bind(minimum_height=explainLayout.setter('height')) explainLabel = SLabel(text=explainStr, size_hint=(1, None)) explainLabel.font_name = CONSTS.FONT_NAME explainLabel.color = colorHex("#000000") explainLayout.add_widget(explainLabel) slview.add_widget(explainLayout) bottomLayout = BoxLayout(size_hint=(1, .08)) closebtn_id = SButton(text="關閉", size_hint=(1, .8)) bottomLayout.add_widget(closebtn_id) contentLayout.add_widget(bottomLayout) popup = SPopup(title="股票代碼說明", content=contentLayout, size_hint=(None, None), size=(500, 400), auto_dismiss=False) closebtn_id.bind(on_press=popup.dismiss) popup.title_font = CONSTS.FONT_NAME popup.open()
def showErrorView(self, isGetMsgDesc, msgCode, msgDesc=None): contentLayout = BoxLayout() contentLayout.orientation = "vertical" contentLayout.size_hint = (1, 1) if isGetMsgDesc == True: msgCodeDict = self.confDict.get(CONSTS.MSG_CODE_DICT) msgText = msgCodeDict.get(msgCode) if msgText == None: msgText = "Unknow error code->" + str(msgCode) else: msgText = str(msgCode) + "->" + msgText if msgDesc == None or msgDesc == "": contentLabel = SLabel(text=msgText, size_hint=(1, .8)) contentLabel.halign = "center" contentLayout.add_widget(contentLabel) else: titleLabel = SLabel(text=msgText, size_hint=(1, .2)) titleLabel.halign = "center" contentLayout.add_widget(titleLabel) slview = ScrollView(size_hint=(1, .6)) contentLayout.add_widget(slview) explainLayout = STableGridLayout(cols=1, spacing=1, size_hint_y=None) explainLayout.bind( minimum_height=explainLayout.setter('height')) for aStr in msgDesc: explainLabel = SLabel(text=aStr, size_hint=(1, None), height=20) explainLabel.halign = "center" explainLabel.color = colorHex("#000000") explainLabel.font_name = CONSTS.FONT_NAME explainLayout.add_widget(explainLabel) slview.add_widget(explainLayout) else: msgText = str(msgCode) + "->" + msgDesc contentLabel = SLabel(text=msgText, size_hint=(1, .8)) contentLabel.halign = "center" contentLayout.add_widget(contentLabel) sysConfDict = self.confDict.get(CONSTS.SYS_CONF_DICT) contentBtn = SButton(text=sysConfDict.get("MSG_CONFIRM"), size_hint=(1, .2)) contentLayout.add_widget(contentBtn) popup = Popup(title=sysConfDict.get("MSG_TITLE"), content=contentLayout, size_hint=(None, None), size=(200, 200), auto_dismiss=False) contentBtn.bind(on_press=popup.dismiss) popup.title_font = CONSTS.FONT_NAME popup.open()
def showErrMsg(self, errList): filePath = os.path.join( os.path.dirname(__file__), ".." + os.sep + "conf" + os.sep + "err_explain.ini") with open(filePath, 'r', encoding='utf-8-sig') as f: lineList = f.readlines() explainStr = "" for astr in lineList: explainStr += astr explainStr += "\n\n" for astr in errList: explainStr += astr + "\n" contentLayout = BoxLayout(size_hint=(1, 1), orientation="vertical") slview = ScrollView(size_hint=(1, .92)) contentLayout.add_widget(slview) explainLayout = BoxLayout(size_hint=(1, None)) explainLayout.bind(minimum_height=explainLayout.setter('height')) explainLabel = SLabel(text=explainStr, size_hint=(1, None)) explainLabel.halign = "center" explainLabel.font_name = CONSTS.FONT_NAME explainLayout.add_widget(explainLabel) slview.add_widget(explainLayout) bottomLayout = BoxLayout(size_hint=(1, .08)) closebtn_id = SButton(text="關閉", size_hint=(1, .8)) bottomLayout.add_widget(closebtn_id) contentLayout.add_widget(bottomLayout) popup = Popup(title="錯誤格式說明", content=contentLayout, size_hint=(None, None), size=(680, 400), auto_dismiss=False) closebtn_id.bind(on_press=popup.dismiss) popup.title_font = CONSTS.FONT_NAME popup.open()