コード例 #1
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
コード例 #2
0
    def __init__(self, paramDict, **kwargs):
        super(SOptionElement, self).__init__(**kwargs)

        optionDict = paramDict.get("OptionDict")
        self.formulaId = optionDict.get("FormulaID")
        self.paraDesc = optionDict.get("ParaDesc")
        self.paraDict = {}
        self.paraStrDict = {}
        self.paraList = optionDict.get("ParameterList")
        for aDict in self.paraList:
            self.paraDict[aDict.get("Name")] = aDict

        self._objDict = {}
        self.size_hint = (1, .98)
        self.orientation = "horizontal"

        self._isSelected_id = CheckBox()
        self._isSelected_id.active = False
        self._isSelected_id.size_hint = (.1, 1)
        self._isSelected_id.color = colorHex("#000000")
        self.add_widget(self._isSelected_id)

        self.add_widget(BoxLayout(size_hint=(.01, 1)))

        self.contentLayout = BoxLayout(size_hint=(.89, 1),
                                       orientation="horizontal")
        self.add_widget(self.contentLayout)

        if self.hasFunc(self.paraDesc):
            strList = self.paraDesc.split(" ")
            for astr in strList:
                if self.hasFunc(astr):
                    paraName = astr[astr.find("#") + 1:]
                    self.paraStrDict[paraName] = astr
                    _atextInput = SOptionTextInput(paraName=paraName,
                                                   size_hint=(None, 1))
                    _atextInput.text = self.paraDict.get(paraName).get("Def")
                    _atextInput.width = 60
                    self.contentLayout.add_widget(_atextInput)
                    self._objDict[paraName] = _atextInput
                else:
                    _alabel = SLabel(text=astr, size_hint=(None, 1))
                    _alabel.width = self.calcStrWidth(astr)
                    _alabel.color = colorHex("#000000")
                    self.contentLayout.add_widget(_alabel)
        else:
            _alabel = SLabel(text=self.paraDesc, size_hint=(1, 1))
            _alabel.color = colorHex("#000000")
            self.contentLayout.add_widget(_alabel)
コード例 #3
0
    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()
コード例 #4
0
    def showSelectedOptionDesc(self):
        if self.optionList == None:
            return
        mainContent = BoxLayout(size_hint=(1, 1), orientation="vertical")

        slview = STableScrollView()
        slview.size_hint = (1, None)
        slview.size = (480, 160)
        contentLayout = STableGridLayout(cols=1, spacing=2, size_hint_y=None)
        # Make sure the height is such that there is something to scroll.
        contentLayout.bind(minimum_height=contentLayout.setter('height'))
        slview.add_widget(contentLayout)
        aLabel = None
        rowIndex = 0
        for aObj in self.optionList:
            if aObj.isSelected() != True:
                continue
            rowIndex += 1
            aStr = str(rowIndex) + ". " + aObj.getOptionDesc()
            aLabel = SLabel(text=aStr,size_hint=(1, None), height=30)
            aLabel.color = colorHex("#000000")
            contentLayout.add_widget(aLabel)      
        showSelectFile_popup = SPopup(title="已選條件", content=mainContent,
                size_hint=(None, None), size=(480, 250), auto_dismiss=False)
        showSelectFile_popup.title_font = CONSTS.FONT_NAME
        mainContent.add_widget(slview)
        closeBtn = SButton(text="關閉")
        closeBtn.bind(on_press=showSelectFile_popup.dismiss)
        mainContent.add_widget(closeBtn)
        showSelectFile_popup.open()
コード例 #5
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()
コード例 #6
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
コード例 #7
0
    def __init__(self, paramDict, **kwargs):
        super(SelfStkSetting, self).__init__(**kwargs)

        self.paramDict = paramDict
        self.app = self.paramDict.get(CONSTS.S_APP)
        self.selfgroup_index = self.paramDict.get("SelfGroupIndex")
        self.selfgroup_name = self.paramDict.get("SelfGroupName")
        self.selfStkList = self.paramDict.get("SelfStkList")

        self.size_hint = (1, 1)
        self.orientation = "vertical"

        self.add_widget(STableBoxLayout(size_hint=(1, None), height=1))

        nameLayout = SBoxLayout(size_hint=(1, None), height=30)
        nameLayout.orientation = "horizontal"

        nameLayout.add_widget(STableBoxLayout(size_hint=(.02, 1)))

        nameLabel = SLabel(text="名稱:", size_hint=(.15, 1))
        nameLabel.color = colorHex("#000000")
        nameLayout.add_widget(nameLabel)

        self.selfgroup_name_id = STextInput(text=self.selfgroup_name,
                                            size_hint=(.65, 1))
        nameLayout.add_widget(self.selfgroup_name_id)

        nameLayout.add_widget(STableBoxLayout(size_hint=(.23, 1)))

        self.add_widget(nameLayout)

        self.add_widget(STableBoxLayout(size_hint=(1, None), height=1))

        headLayout = STableGridLayout(cols=3,
                                      rows=1,
                                      spacing=2,
                                      size_hint=(1, None),
                                      height=30)
        headLabel = SHeadLabel(text="功能", size_hint=(.15, 1))
        headLabel.halign: 'center'
        headLabel.valign: 'middle'
        headLayout.add_widget(headLabel)
        headLabel = SHeadLabel(text="代碼", size_hint=(.2, 1))
        headLabel.halign: 'center'
        headLabel.valign: 'middle'
        headLayout.add_widget(headLabel)
        headLabel = SHeadLabel(text="名稱", size_hint=(.65, 1))
        headLabel.halign: 'center'
        headLabel.valign: 'middle'
        headLayout.add_widget(headLabel)
        self.add_widget(headLayout)

        self.add_widget(STableBoxLayout(size_hint=(1, None), height=2))

        self.def_ids = {}

        slview = STableScrollView()
        slview.size_hint = (1, None)
        slview.size = (360, 320)
        self.contentLayout = STableGridLayout(cols=3,
                                              spacing=2,
                                              size_hint_y=None)
        # Make sure the height is such that there is something to scroll.
        self.contentLayout.bind(
            minimum_height=self.contentLayout.setter('height'))

        tmpList = None
        stkName = None
        for stkId in self.selfStkList:
            tmpList = []
            tmpList.append(stkId)
            stkName = self.app.stkNameDict.get(stkId)
            if stkName == None:
                tmpList.append("")
            else:
                tmpList.append(stkName)
            self.addListRow(tmpList)

        self.addInsertRow()
        slview.add_widget(self.contentLayout)

        self.add_widget(slview)

        bottomLayout = BoxLayout(size_hint=(1, None), height=30)
        self.ensurebtn_id = SButton(text="確定", size_hint=(.49, 1))
        bottomLayout.add_widget(self.ensurebtn_id)
        bottomLayout.add_widget(BoxLayout(size_hint=(.02, 1)))
        self.cancelbtn_id = SButton(text="取消", size_hint=(.49, 1))
        bottomLayout.add_widget(self.cancelbtn_id)
        self.add_widget(bottomLayout)