def addInsertRow(self):
        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=INSERT_ROW_ID,
                          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=(.2, None), height=30)
        contentLabel.halign = "center"
        contentLabel.valign = "middle"
        rowList.append(contentLabel)
        self.contentLayout.add_widget(contentLabel)
        contentLabel = SContentLabel(text="", size_hint=(.65, None), height=30)
        contentLabel.halign = "left"
        contentLabel.valign = "middle"
        rowList.append(contentLabel)
        self.contentLayout.add_widget(contentLabel)

        self.def_ids[INSERT_ROW_ID] = 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
示例#3
0
    def __init__(self, paramDict, **kwargs):
        super(SStrategySetting, self).__init__(**kwargs)

        self.ensurebtn_id = SInfoButton(extra_info=self.extra_info)
        self.ensurebtn_id.text = "確定"
        self.ensurebtn_id.size_hint = (1, 1)
        self.ensurebtn_id.halign = "center"
        self.ensurebtn_id.valign = "middle"
        
        self.ensureLayout_id.clear_widgets()
        self.ensureLayout_id.add_widget(self.ensurebtn_id)
        
        mode = paramDict.get('mode')
        if mode == "1":
            self.filename_id.text = self.getFilename()
        self.filename_id.disabled = True
示例#4
0
    def _klineDataTypeDropDown(self):
        """
        資料類型:
        1.日線(ABGW_PRICEDATA_DAY)
        2.周線(ABGW_PRICEDATA_WEEK)
        3.月線(ABGW_PRICEDATA_MONTH)
        4.季線(ABGW_PRICEDATA_QUARTER)
        5.半年線(ABGW_PRICEDATA_HYEAR)
        6.年線(ABGW_PRICEDATA_YEAR)
        10.1分線(ABGW_PRICEDATA_MIN)
        11.5分線(ABGW_PRICEDATA_MIN5)
        12.10分線(ABGW_PRICEDATA_MIN10)
        13.15分線(ABGW_PRICEDATA_MIN15)
        14.20分線(ABGW_PRICEDATA_MIN20)
        15.30分線(ABGW_PRICEDATA_MIN30)
        16.60分線(ABGW_PRICEDATA_MIN60)
        100.往前復權基準值(ABGW_PRICEDATA_FRBASE)
        200.往後復權基準值(ABGW_PRICEDATA_BRBASE)
        復權需加上復權基準值,如 往前復權日線: 101,往後復權日線: 201
        """
        self.kdtDropDown = DropDown()
        self.dataTypeDict = {}
        filePath = os.path.join(
            os.path.dirname(__file__),
            ".." + os.sep + "conf" + os.sep + "kline_datatype.ini")
        alist = sutil.getListFromFile(filePath)
        firstRecord = True
        for astr in alist:
            aIdx = astr.find("=")
            if aIdx == -1:
                continue
            aKey = astr[:aIdx]
            aValue = astr[aIdx + 1:]
            if firstRecord:
                firstRecord = False
                self.klineDataType_id.text = aValue
                self.klineDataType_index = int(aKey)
            abtn = SInfoButton(extra_info=int(aKey), text=aValue)
            abtn.size_hint_y = None
            abtn.height = 30
            abtn.bind(on_release=self.kdtDropDown.select)
            self.kdtDropDown.add_widget(abtn)
            self.dataTypeDict[str(abtn.extra_info)] = abtn

        self.klineDataType_id.bind(on_release=self.kdtDropDown.open)
        self.kdtDropDown.bind(on_select=self._kdtDropDownSelect)
示例#5
0
    def _technicalDropDown(self):
        self.techDropDown = DropDown()
        self.techTypeDict = {}
        filePath = os.path.join(
            os.path.dirname(__file__),
            ".." + os.sep + "conf" + os.sep + "formula_id.ini")
        alist = sutil.getListFromFile(filePath)
        firstRecord = True
        aKey = None
        aValue = None
        for astr in alist:
            aIdx = astr.find("=")
            if aIdx == -1:
                continue
            aKey = astr[:aIdx]
            aValue = astr[aIdx + 1:]
            if firstRecord:
                firstRecord = False
                self.techType_id.text = aValue
                self.techType_index = int(aKey)
            abtn = SInfoButton(extra_info=int(aKey), text=aValue)
            abtn.size_hint_y = None
            abtn.height = 30
            abtn.bind(on_release=self.techDropDown.select)
            self.techDropDown.add_widget(abtn)
            self.techTypeDict[str(abtn.extra_info)] = abtn

        self.techType_id.bind(on_release=self.techDropDown.open)
        self.techDropDown.bind(on_select=self._techDropDownSelect)

        self.formulaMapping = {}
        filePath = os.path.join(
            os.path.dirname(__file__),
            ".." + os.sep + "conf" + os.sep + "formula_mapping.ini")
        alist = sutil.getListFromFile(filePath)
        for astr in alist:
            aIdx = astr.find("=")
            if aIdx == -1:
                continue
            aKey = astr[:aIdx]
            aValue = astr[aIdx + 1:]
            self.formulaMapping[aKey] = aValue.split(",")
示例#6
0
    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
示例#7
0
    def __init__(self, paramDict, **kwargs):
        super(SelfStkQuote, self).__init__(**kwargs)

        self.paramDict = paramDict
        self.app = self.paramDict.get(CONSTS.S_APP)

        self.quoteDataDict = {}
        self.selfDict = {}
        self.selfDropDown = SSelfDropDown()
        self.dropDownDict = {}
        firstRecord = True
        selfGroupList = None
        filePath = os.path.join(
            os.path.dirname(__file__),
            ".." + os.sep + "conf" + os.sep + "self_stkquote.ini")
        alist = sutil.getListFromFile(filePath)
        for astr in alist:
            selfGroupList = astr.strip().split(",")
            if len(selfGroupList) < 3:
                continue
            if firstRecord:
                firstRecord = False
                self.selfgroup_id.text = selfGroupList[1]
                self.selfgroup_index = int(selfGroupList[0])
            self.selfDict[int(selfGroupList[0])] = selfGroupList
            abtn = SInfoButton(extra_info=int(selfGroupList[0]),
                               text=selfGroupList[1])
            abtn.size_hint_y = None
            abtn.height = 30
            abtn.bind(on_release=self.selfDropDown.select)
            self.selfDropDown.add_widget(abtn)
            self.dropDownDict[str(abtn.extra_info)] = abtn

        self.selfgroup_id.bind(on_release=self.selfDropDown.open)
        self.selfDropDown.bind(on_select=self.selfSelect)

        self.stkidList = []
        self.num_per_page = NUM_PER_PAGE
        self.page_num = 1
        self.max_page_num = 1

        self.page_id.bind(on_text_validate=self._on_page_id_enter)

        filePath = os.path.join(
            os.path.dirname(__file__),
            ".." + os.sep + "conf" + os.sep + "stkfields_setting.ini")
        alist = sutil.getListFromFile(filePath)
        headDefineDict = {}
        for astr in alist:
            astrList = astr.strip().split(",")
            if len(astrList) < 2:
                continue
            headDefineDict[astrList[0]] = astrList[1]
        headDict = {}
        headDict["id"] = headDefineDict.get("id")  #SID
        headDict["name"] = headDefineDict.get("name")  #SNT
        seqStr = headDefineDict.get("_SEQ_")
        seqStrList = seqStr.split("|")
        for headId in seqStrList:
            headDict[headId] = headDefineDict.get(headId)
        self.stkquote = StkQuote({
            CONSTS.S_APP: self.app,
            'headDict': headDict,
            'dispIdName': True
        })

        self.body_layout.remove_widget(self.content_layout)
        self.content_layout = self.stkquote
        self.content_layout.size_hint = (1, 1)
        self.body_layout.add_widget(self.content_layout)

        Clock.schedule_once(self.doQuoteStart, .5)  #此段用意為讓畫面先顯示出來,再做後續的動作