Example #1
0
    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()
Example #2
0
 def _createMixedChartInfoObj(self, lineSetupList):
     if lineSetupList == None or len(lineSetupList) == 0:
         return
     self.mixedChartInfo_layout.clear_widgets()
     aLabel = SLabel(text=" ", size_hint=(None, 1), width=10)
     aLabel.color = colorHex("#00142D")
     self.mixedChartInfo_layout.add_widget(aLabel)
     self.mixedChartInfoObjDict = {}
     isAmt = False
     for aDict in lineSetupList:
         aName = aDict.get("name")
         if aName == "成交金額":
             isAmt = True
         lwidth = schartutil.getInfoLayoutWidth(
             schartutil.calcCharNum(aName))
         aLabel = SLabel(text=aName + " ",
                         size_hint=(None, 1),
                         width=lwidth)
         aLabel.color = aDict.get("color")
         self.mixedChartInfo_layout.add_widget(aLabel)
         if isAmt == True:
             lwidth = DEFAULT_WIDTH2
         else:
             lwidth = DEFAULT_WIDTH
         aLabel = SLabel(text="", size_hint=(None, 1), width=lwidth)
         aLabel.color = DEFAULT_COLOR
         aLabel.halign = "left"
         self.mixedChartInfo_layout.add_widget(aLabel)
         self.mixedChartInfoObjDict[aName] = aLabel
Example #3
0
 def _createPriceInfoObj(self, lineSetupList):
     if lineSetupList == None or len(lineSetupList) == 0:
         return
     self.head_layout.clear_widgets()
     aLabel = SLabel(text=" ", size_hint=(None, 1), width=10)
     aLabel.color = colorHex("#00142D")
     self.head_layout.add_widget(aLabel)
     self.priceInfoObjDict = {}
     for aDict in lineSetupList:
         aName = aDict.get("name")
         lwidth = schartutil.getInfoLayoutWidth(
             schartutil.calcCharNum(aName))
         aLabel = SLabel(text=aName + " ",
                         size_hint=(None, 1),
                         width=lwidth)
         aLabel.color = aDict.get("color")
         self.head_layout.add_widget(aLabel)
         aLabel = SLabel(text="", size_hint=(None, 1), width=DEFAULT_WIDTH)
         aLabel.color = DEFAULT_COLOR
         aLabel.halign = "left"
         self.head_layout.add_widget(aLabel)
         self.priceInfoObjDict[aName] = aLabel
Example #4
0
    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()