Exemplo n.º 1
0
    def initDialog(self):
        try:
            #print os.path.abspath('.')
            config = ET.parse(file_operate.getConfigXmlPath())
            root = config.getroot()

            #渠道信息
            channel = root.find("channel")
            self.lineEdit.setText(channel.get("gameId"))

            if channel.get("resVersion") != None:
                self.lineEdit_10.setText(channel.get("resVersion"))
            else:
                self.lineEdit_10.setText("")

            #平台信息
            platform = root.find("platform")
            self.lineEdit_5.setText(platform.get("gameId"))
            self.lineEdit_6.setText(platform.get("platformId"))
            self.lineEdit_7.setText(platform.get("appVersion"))
            self.lineEdit_8.setText(platform.get("platformType"))
            self.lineEdit_9.setText(platform.get("datacenter"))
            app = root.find("app")
            self.lineEdit_11.setText(app.get("packageName"))

            #read form ForManifest.xml
            ET.register_namespace('android', constant.androidNS)
            configTree = ET.parse(file_operate.getForManifestXmlPath())
            configRoot = configTree.getroot()
            key = '{' + constant.androidNS + '}name'
            value = '{' + constant.androidNS + '}value'
            applicationCfg = configRoot.find("applicationCfg")
            if applicationCfg is None:
                return
            metaConfigList = applicationCfg.findall("meta-data")

            for child in metaConfigList:
                if child.attrib[key] == "BaiduMobAd_CHANNEL":
                    self.lineEdit_3.setText(child.attrib[value])
                elif child.attrib[key] == "BaiduMobAd_STAT_ID":
                    self.lineEdit_4.setText(child.attrib[value])

            #read pid from res/raw/manifest.txt
            fileName = file_operate.getFullPath(
                constant.sdkRelatePath +
                ConfigParse.shareInstance().getChannelName() +
                "/ForRes/raw/manifest.txt")
            f = open(fileName, "r")
            lines = f.read()  #读取全部内容
            print lines
            import json
            hJson = json.loads(lines)
            self.lineEdit_2.setText(hJson["pid"])

        except Exception, e:
            print e
            print "Error: cannot parse file: funcellconfig.xml."
            return -1
Exemplo n.º 2
0
    def onOkClicked(self):
        try:
            #print os.path.abspath('.')
            config = ET.parse(file_operate.getConfigXmlPath())
            root = config.getroot()

            #渠道信息
            channel = root.find("channel")
            channel.set("gameId", unicode(self.lineEdit.text()))
            channel.set("resVersion", unicode(self.lineEdit_10.text()))

            #平台信息
            platform = root.find("platform")
            platform.set("gameId", unicode(self.lineEdit_5.text()))
            platform.set("platformId", unicode(self.lineEdit_6.text()))
            platform.set("appVersion", unicode(self.lineEdit_7.text()))
            platform.set("platformType", unicode(self.lineEdit_8.text()))
            platform.set("datacenter", unicode(self.lineEdit_9.text()))

            app = root.find("app")
            app.set("packageName", unicode(self.lineEdit_11.text()))

            config.write(file_operate.getConfigXmlPath(), "utf-8")

            #write metadata to ForManifest
            ET.register_namespace('android', constant.androidNS)
            configTree = ET.parse(file_operate.getForManifestXmlPath())
            configRoot = configTree.getroot()
            key = '{' + constant.androidNS + '}name'
            value = '{' + constant.androidNS + '}value'
            applicationCfg = configRoot.find("applicationCfg")
            if applicationCfg is None:
                return
            metaConfigList = applicationCfg.findall("meta-data")

            for child in metaConfigList:
                if child.attrib[key] == "BaiduMobAd_CHANNEL":
                    child.set(value, unicode(self.lineEdit_3.text()))
                elif child.attrib[key] == "BaiduMobAd_STAT_ID":
                    child.set(value, unicode(self.lineEdit_4.text()))

            configTree.write(file_operate.getForManifestXmlPath(), "utf-8")

            #write pid from res/raw/manifest.txt
            fileName = file_operate.getFullPath(
                constant.sdkRelatePath +
                ConfigParse.shareInstance().getChannelName() +
                "/ForRes/raw/manifest.txt")
            f = open(fileName, "w")
            data = "{\"pid\":\"%s\"}" % unicode(self.lineEdit_2.text())
            f.write(data)

        except Exception, e:
            print e
            print "Error: cannot parse file: funcellconfig.xml."
            return -1
Exemplo n.º 3
0
    def log(self, str, flag=False):
        print 'flag:', flag
        logDir = 'Log/'
        productcode = ConfigParse.shareInstance().getProductCode()
        if not os.path.exists(logDir + productcode):
            os.makedirs(logDir + productcode)

        if flag:
            self.modifyFileContent(logDir + productcode + '/SignFile.log',
                                   "|Default", "")

        logFile = codecs.open(logDir + productcode + '/SignFile.log', 'a+',
                              'utf-8')
        content = str + '\n'
        logFile.write(unicode(content, 'gbk'))
        logFile.close()
Exemplo n.º 4
0
    def onOkClicked(self):
        try:
            #print os.path.abspath('.')
            config = ET.parse(file_operate.getConfigXmlPath())
            root = config.getroot()

            #渠道信息
            channel = root.find("channel")
            channel.set("appId", unicode(self.lineEdit.text()))
            channel.set("base64PublicKey", unicode(self.lineEdit_2.text()))
            
            config.write(file_operate.getConfigXmlPath(), "utf-8")
            
            
            valuesFolder = constant.sdkRelatePath + ConfigParse.shareInstance().getChannelName()+"/ForRes/values/"
            #write ForRes/values/strings.xml
            stringsXml = valuesFolder + "strings.xml"
            configTree = ET.parse(file_operate.getFullPath(stringsXml))
            configRoot = configTree.getroot()
            stringList = configRoot.findall("string")
            finedapiKey = False
            finedgcmKey = False
            findedKakaoKey = False
            finedKakaoScheme = False
            for stringItem in stringList:
                if (stringItem.attrib["name"] == "nextmv_api_key"):
                    stringItem.text = unicode(self.lineEdit_3.text())
                    finedapiKey = True
                elif (stringItem.attrib["name"] == "gcm_key"):
                    stringItem.text = unicode(self.lineEdit_4.text())
                    finedgcmKey = True
                elif (stringItem.attrib["name"] == "kakao_app_key"):
                    stringItem.text = unicode(self.lineEdit_5.text())
                    findedKakaoKey = True
                elif (stringItem.attrib["name"] == "kakao_scheme"):
                    stringItem.text = unicode(self.lineEdit_6.text())
                    finedKakaoScheme = True
                
                if finedapiKey and finedgcmKey and findedKakaoKey and finedKakaoScheme:
                    break
            configTree.write(stringsXml, "utf-8")
                    
        
        except Exception,e:
            print e
            print "Error: cannot parse file: funcellconfig.xml."
            return -1
Exemplo n.º 5
0
    def initKeystoreList(self):
        self.listWidget.clear()
        self.__keystoreDetails.clear()

        logDir = 'Log/'
        productcode = ConfigParse.shareInstance().getProductCode()
        logFile = codecs.open(logDir + productcode + '/SignFile.log', 'a+',
                              'utf-8')

        for line in logFile.readlines():

            if line.count > 0:
                line = line.rstrip("\r\n")  #此处需要去掉隐藏的\r\n,才能匹配
                Info = line.split('|')
                #                 Kestore_basename = os.path.basename(utils.file_operate.getFullPath(str(Info[0])))
                Kestore_basename = os.path.basename(
                    utils.file_operate.getFullPath(unicode(Info[0])))
                labelKestoreName = QLabel(Kestore_basename)
                labelKestoreName.setStyleSheet("color: rgb(0, 0, 0);")
                labelAliasName = QLabel(Info[2])
                labelAliasName.setStyleSheet("color: rgb(0, 0, 0);")
                button = QPushButton(u"详情")
                button.setStyleSheet(
                    "background-color: rgb(0, 170, 255);\n color: rgb(255, 255, 255);\n"
                )

                layout = QHBoxLayout()
                layout.addWidget(labelKestoreName)
                layout.addStretch()
                layout.addWidget(labelAliasName)
                layout.addWidget(button)

                widget = QWidget()
                widget.setLayout(layout)

                item = QtGui.QListWidgetItem()
                item.setSizeHint(QSize(0, 40))
                self.listWidget.addItem(item)
                self.listWidget.setItemWidget(item, widget)
                self.__keystoreDetails[button] = line

        logFile.close()

        for key in self.__keystoreDetails.keys():
            key.clicked.connect(
                partial(self.KeyStoreDetails, self.__keystoreDetails[key]))
Exemplo n.º 6
0
    def updateConfig(self, keystoreUi_Class, keystoreDetails):
        import sys
        reload(sys)
        sys.setdefaultencoding('utf-8')

        flag = False
        flag_modify = True
        old_str = keystoreDetails
        new_str = keystoreUi_Class.lineEdit.text(
        ) + "|" + keystoreUi_Class.lineEdit_2.text(
        ) + "|" + keystoreUi_Class.lineEdit_3.text(
        ) + "|" + keystoreUi_Class.lineEdit_4.text()
        if keystoreUi_Class.checkBox.isChecked():
            new_str += "|Default"
            flag = True
        logDir = 'Log/'
        #-------------------start---------此步骤是为了查询当前需要修改的字符串是否需要删除'|Default' -------------
        productcode = ConfigParse.shareInstance().getProductCode()
        logFile = codecs.open(logDir + productcode + '/SignFile.log', 'a+',
                              'utf-8')
        for line in logFile.readlines():
            line = line.rstrip("\r\n")
            if keystoreDetails == line:
                idx = line.find('|Default')
                if idx > 0:
                    print '当前修改项中包含|Default字段,当前修改项不能删除|Default字段'
                    flag_modify = False

        logFile.close()
        #-------------------end-----------------------

        if flag and flag_modify:  #先判断是否需要替换"|Default"
            self.modifyFileContent(logDir + productcode + '/SignFile.log',
                                   "|Default", "")

        new_str = str(new_str)
        old_str = str(old_str)
        print 'old_str:', old_str
        print 'new_str:', new_str
        #         self.modifyFileContent(logDir +productcode  + '/SignFile.log', str(old_str), str(new_str))
        self.modifyFileContent(logDir + productcode + '/SignFile.log', old_str,
                               new_str)
        if flag:
            taskManager.shareInstance().updateKeystore(new_str, False)
        keystoreUi_Class.close()
        self.initKeystoreList()
Exemplo n.º 7
0
    def initDialog(self):
        try:
            #print os.path.abspath('.')
            config = ET.parse(file_operate.getConfigXmlPath())
            root = config.getroot()

            #渠道信息
            channel = root.find("channel")
            self.lineEdit.setText(channel.get("privateKey"))
            self.lineEdit_2.setText(channel.get("funcellKey"))

            valuesFolder = constant.sdkRelatePath + ConfigParse.shareInstance(
            ).getChannelName() + "/ForRes/values/"
            #read ForRes/values/strings.xml
            stringsXml = valuesFolder + "strings.xml"
            configTree = ET.parse(file_operate.getFullPath(stringsXml))
            configRoot = configTree.getroot()
            stringList = configRoot.findall("string")
            finedapiKey = False
            finedgcmKey = False
            findedKakaoKey = False
            finedKakaoScheme = False
            for stringItem in stringList:
                if (stringItem.attrib["name"] == "nextmv_api_key"):
                    print stringItem.text
                    self.lineEdit_3.setText(stringItem.text)
                    finedapiKey = True
                elif (stringItem.attrib["name"] == "gcm_key"):
                    print stringItem.text
                    self.lineEdit_4.setText(stringItem.text)
                    finedgcmKey = True
                elif (stringItem.attrib["name"] == "kakao_app_key"):
                    self.lineEdit_5.setText(stringItem.text)
                    findedKakaoKey = True
                elif (stringItem.attrib["name"] == "kakao_scheme"):
                    self.lineEdit_6.setText(stringItem.text)
                    finedKakaoScheme = True

                if finedapiKey and finedgcmKey and findedKakaoKey and finedKakaoScheme:
                    break

        except Exception, e:
            print e
            print "Error: cannot parse file: funcellconfig.xml."
            return -1
Exemplo n.º 8
0
     channel.set("funcellKey", unicode(self.funcellKey_2.text()))
     channel.set("facebook_app_id", unicode(self.facebook_app_id.text()))
     channel.set("googleGameAppId", unicode(self.googleGameAppId.text()))
     channel.set("base64PublicKey", unicode(self.base64PublicKey.text()))
     channel.set("resVersion", unicode(self.resVersion.text()))
     
     config.write(file_operate.getConfigXmlPath(), "utf-8")
     
     
 except Exception,e:
     print e
     print "Error: cannot parse file: funcellconfig.xml."
     return -1   
 
 try:
     funcellStringConfig = ET.parse(file_operate.getFullPath(constant.sdkRelatePath + ConfigParse.shareInstance().getChannelName()+"/ForRes/values/fun_strings.xml"))
     funcellStringConfigRoot = funcellStringConfig.getroot()
      
     for funcellStringConfigNode in funcellStringConfigRoot:
         if funcellStringConfigNode.attrib['name']=="googleGameAppId" :
             funcellStringConfigNode.text=unicode(self.googleGameAppId.text())
         elif funcellStringConfigNode.attrib['name']=="facebook_app_id" :
             funcellStringConfigNode.text=unicode(self.facebook_app_id.text())
         elif funcellStringConfigNode.attrib['name']=="WWS_CHANNEL":
             funcellStringConfigNode.text=unicode(self.appId.text())
     funcellStringConfig.write(file_operate.getFullPath(constant.sdkRelatePath + ConfigParse.shareInstance().getChannelName() + "/ForRes/values/fun_strings.xml"), "utf-8")
 except Exception,e:
     print e
     print "Error: cannot parse file: efunGameConfig.xml."
     return -1
 
Exemplo n.º 9
0
    def __init__(self, parent=None):
        super(MyChannelItem, self).__init__(parent)
        self.resize(572, 111)

        self.setStyleSheet((
            "QPushButton[objectName=\"pushButton\"],QPushButton[objectName=\"pushButton_2\"],QPushButton[objectName=\"pushButton_3\"],QPushButton[objectName=\"pushButton_4\"],QPushButton[objectName=\"pushButton_5\"]{\n"
            "color: rgb(255, 0, 0);\n"
            "border:0px;\n"
            "}"))
        self.label = QtGui.QLabel(self)
        self.label.setGeometry(QtCore.QRect(30, 25, 60, 60))
        self.label.setObjectName(("label"))
        self.label_2 = QtGui.QLabel(self)
        self.label_2.setGeometry(QtCore.QRect(110, 60, 54, 12))
        self.label_2.setObjectName(("label_2"))
        #         self.label_4 = QtGui.QLabel(self)
        self.label_4 = scrollTextLabel(self)
        self.label_4.setGeometry(QtCore.QRect(110, 20, 110, 12))
        self.label_4.setObjectName(("label_4"))
        self.label_5 = QtGui.QLabel(self)
        self.label_5.setGeometry(QtCore.QRect(110, 40, 54, 12))
        self.label_5.setObjectName(("label_5"))
        self.label_6 = QtGui.QLabel(self)
        self.label_6.setGeometry(QtCore.QRect(160, 40, 68, 12))
        self.label_6.setObjectName(("label_6"))
        self.line = QtGui.QFrame(self)
        self.line.setGeometry(QtCore.QRect(220, 10, 16, 91))
        self.line.setFrameShape(QtGui.QFrame.VLine)
        self.line.setFrameShadow(QtGui.QFrame.Sunken)
        self.line.setObjectName(("line"))
        self.label_9 = QtGui.QLabel(self)
        self.label_9.setGeometry(QtCore.QRect(260, 50, 31, 16))
        self.label_9.setObjectName(("label_9"))
        self.lineEdit = QtGui.QLineEdit(self)
        self.lineEdit.setGeometry(QtCore.QRect(310, 50, 181, 20))
        self.lineEdit.setObjectName(("lineEdit"))
        self.lineEdit.setReadOnly(True)
        self.lineEdit_2 = QtGui.QLineEdit(self)
        self.lineEdit_2.setGeometry(QtCore.QRect(310, 80, 181, 20))
        self.lineEdit_2.setObjectName(("lineEdit_2"))
        self.lineEdit_2.setReadOnly(True)
        self.label_10 = QtGui.QLabel(self)
        self.label_10.setGeometry(QtCore.QRect(260, 80, 31, 16))
        self.label_10.setObjectName(("label_10"))
        self.line_2 = QtGui.QFrame(self)
        self.line_2.setGeometry(QtCore.QRect(0, 0, 572, 1))
        self.line_2.setFrameShape(QtGui.QFrame.HLine)
        self.line_2.setFrameShadow(QtGui.QFrame.Sunken)
        self.line_2.setObjectName(("line_2"))
        self.line_3 = QtGui.QFrame(self)
        self.line_3.setGeometry(QtCore.QRect(0, 110, 572, 1))
        self.line_3.setFrameShape(QtGui.QFrame.HLine)
        self.line_3.setFrameShadow(QtGui.QFrame.Sunken)
        self.line_3.setObjectName(("line_3"))
        #         self.pushButton = QtGui.QPushButton(self)
        self.pushButton = channelItem_pushButton(self)
        self.pushButton.setGeometry(QtCore.QRect(165, 60, 49, 12))
        font = QtGui.QFont()
        font.setFamily(("Aharoni"))
        font.setBold(True)
        font.setUnderline(True)
        font.setWeight(75)
        self.pushButton.setFont(font)
        self.pushButton.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.pushButton.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.pushButton.setStyleSheet("QPushButton{text-align : left;}")
        self.pushButton.setObjectName(("pushButton"))
        self.pushButton_2 = QtGui.QPushButton(self)
        self.pushButton_2.setGeometry(QtCore.QRect(432, 17, 60, 21))
        self.pushButton_2.setCursor(QtGui.QCursor(
            QtCore.Qt.PointingHandCursor))
        font = QtGui.QFont()
        font.setFamily(("Aharoni"))
        font.setBold(True)
        font.setUnderline(True)
        font.setWeight(75)
        self.pushButton_2.setFont(font)
        self.pushButton_2.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.pushButton_2.setStyleSheet((""))
        self.pushButton_2.setObjectName(("pushButton_2"))
        self.pushButton_2.setStyleSheet("QPushButton{text-align : right;}")
        self.pushButton_3 = QtGui.QPushButton(self)
        self.pushButton_3.setGeometry(QtCore.QRect(255, 17, 60, 21))
        self.pushButton_3.setCursor(QtGui.QCursor(
            QtCore.Qt.PointingHandCursor))
        font = QtGui.QFont()
        font.setFamily(("Aharoni"))
        font.setBold(True)
        font.setUnderline(True)
        font.setWeight(75)
        self.pushButton_3.setFont(font)
        self.pushButton_3.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.pushButton_3.setStyleSheet((""))
        self.pushButton_3.setObjectName(("pushButton_3"))
        self.pushButton_4 = QtGui.QPushButton(self)
        self.pushButton_4.setGeometry(QtCore.QRect(165, 80, 41, 12))
        font = QtGui.QFont()
        font.setFamily(("Aharoni"))
        font.setBold(True)
        font.setUnderline(True)
        font.setWeight(75)
        self.pushButton_4.setFont(font)
        self.pushButton_4.setCursor(QtGui.QCursor(
            QtCore.Qt.PointingHandCursor))
        self.pushButton_4.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.pushButton_4.setStyleSheet("QPushButton{text-align : left;}")
        self.pushButton_4.setObjectName(("pushButton_4"))
        self.label_3 = QtGui.QLabel(self)
        self.label_3.setGeometry(QtCore.QRect(110, 80, 54, 12))
        self.label_3.setObjectName(("label_3"))

        self.label.setText(u"游戏图片")
        self.label_2.setText(u"渠道版本:")
        self.label_4.setText(u"渠道名")
        self.label_5.setText(u"渠道号:")
        self.label_6.setText(u"渠道号")
        self.label_9.setText(u"包名")
        self.label_10.setText(u"签名")
        self.pushButton.setText(u"版本号")
        self.pushButton_2.setText(u"设置")
        self.pushButton_3.setText(u"闪屏预览")
        self.pushButton_4.setText(u"详情")
        self.label_3.setText(u"插件详情:")

        logDir = 'Log/'
        productcode = ConfigParse.shareInstance().getProductCode()
        logFile = codecs.open(logDir + productcode + '/SignFile.log', 'a+',
                              'utf-8')
        for line in logFile.readlines():
            line = line.rstrip("\r\n")  #此处需要去掉隐藏的\r\n,才能匹配
            idx = line.find('|Default')
            if idx > 0:
                Info = line.split('|')
                self.lineEdit_2.setText(
                    file_operate.getFullPath(unicode(Info[0])))
                break
            channel.set("base64PublicKey",
                        unicode(self.base64PublicKey.text()))
            channel.set("resVersion", unicode(self.resVersion.text()))

            config.write(file_operate.getConfigXmlPath(), "utf-8")

        except Exception, e:
            print e
            print "Error: cannot parse file: funcellconfig.xml."
            return -1

        try:
            funcellStringConfig = ET.parse(
                file_operate.getFullPath(
                    constant.sdkRelatePath +
                    ConfigParse.shareInstance().getChannelName() +
                    "/ForRes/values/fun_strings.xml"))
            funcellStringConfigRoot = funcellStringConfig.getroot()

            for funcellStringConfigNode in funcellStringConfigRoot:
                if funcellStringConfigNode.attrib['name'] == "googleGameAppId":
                    funcellStringConfigNode.text = unicode(
                        self.googleGameAppId.text())
                elif funcellStringConfigNode.attrib[
                        'name'] == "facebook_app_id":
                    funcellStringConfigNode.text = unicode(
                        self.facebook_app_id.text())
                elif funcellStringConfigNode.attrib['name'] == "WWS_CHANNEL":
                    funcellStringConfigNode.text = unicode(self.appId.text())
            funcellStringConfig.write(
                file_operate.getFullPath(
Exemplo n.º 11
0
from utils.config import ConfigParse
from utils.logs import app_log, access_log

Config = ConfigParse(logger=app_log)
Exemplo n.º 12
0
    def onOkClicked(self):
        try:
            #write metadata to ForManifest
            ET.register_namespace('android', constant.androidNS)

            #渠道信息
            config = ET.parse(file_operate.getConfigXmlPath())
            root = config.getroot()

            #平台信息
            platform = root.find("platform")
            platform.set("gameId", unicode(self.gameId.text()))
            platform.set("platformId", unicode(self.platformId.text()))
            platform.set("appVersion", unicode(self.appVersion.text()))
            platform.set("platformType", unicode(self.platformType.text()))
            platform.set("datacenter", unicode(self.datacenter.text()))

            app = root.find("app")
            app.set("packageName", unicode(self.packageName.text()))

            channel = root.find("channel")
            channel.set("qqAppId", unicode(self.qqappid.text()))
            channel.set("wxAppId", unicode(self.wxappid.text()))
            channel.set("appKey", unicode(self.qqAppkey.text()))
            channel.set("wxAppKey", unicode(self.wxAppkey.text()))
            channel.set("offerId", unicode(self.offerid.text()))
            channel.set("isRelease", unicode(self.comboBox.currentText()))
            channel.set("resVersion", unicode(self.resVersion.text()))

            config.write(file_operate.getConfigXmlPath(), "utf-8")

            doc = minidom.parse(file_operate.getForManifestXmlPath())
            rootNode = doc.documentElement
            applicationList = rootNode.getElementsByTagName('applicationCfg')
            for applicationNode in applicationList:
                activityList = applicationNode.getElementsByTagName('activity')
                pattern = re.compile(".+\.wxapi\.WXEntryActivity$")
                patternAuthActivity = re.compile(
                    "com.tencent.tauth.AuthActivity")
                for activityNode in activityList:
                    if pattern.match(
                            activityNode.getAttribute('android:name')):
                        activityNode.setAttribute(
                            'android:name',
                            unicode(self.packageName.text()) +
                            '.wxapi.WXEntryActivity')
                        activityNode.setAttribute(
                            'android:taskAffinity',
                            unicode(self.packageName.text()) + '.diff')
                        intentfilterList = activityNode.getElementsByTagName(
                            'intent-filter')
                        for intentfilterNode in intentfilterList:
                            dataList = intentfilterNode.getElementsByTagName(
                                'data')
                            for dataNode in dataList:
                                dataNode.setAttribute(
                                    'android:scheme',
                                    unicode(self.wxappid.text()))
                    elif patternAuthActivity.match(
                            activityNode.getAttribute('android:name')):
                        intentfilterList = activityNode.getElementsByTagName(
                            'intent-filter')
                        for intentfilterNode in intentfilterList:
                            dataList = intentfilterNode.getElementsByTagName(
                                'data')
                            for dataNode in dataList:
                                dataNode.setAttribute(
                                    'android:scheme',
                                    'tencent' + unicode(self.qqappid.text()))

            f = codecs.open(file_operate.getForManifestXmlPath(), 'w', 'utf-8')
            doc.writexml(f, encoding='utf-8')
            f.close()

            #modify assets ysdkconfig.ini
            configiniPath = file_operate.getFullPath(
                constant.sdkRelatePath +
                ConfigParse.shareInstance().getChannelName() +
                "/ForAssets/ysdkconf.ini")
            ysdk = codecs.open(configiniPath, 'w')
            if self.comboBox.currentText() == "debug":
                ysdkUrl = "YSDK_URL=https://ysdktest.qq.com"
            else:
                ysdkUrl = "YSDK_URL=https://ysdk.qq.com"
            configInfo = ""
            configInfo += ysdkUrl + '\n'
            configInfo += "QQ_APP_ID=%s" % self.qqappid.text() + '\n'
            configInfo += "WX_APP_ID=%s" % self.wxappid.text() + '\n'
            configInfo += "OFFER_ID=%s" % self.offerid.text() + '\n'
            ysdk.write(configInfo)
            ysdk.flush()
            ysdk.close()

        except Exception, e:
            print e
            print "Error: cannot parse file: funcellconfig.xml."
            return -1
Exemplo n.º 13
0
    def __init__(self, parent=None):
        super(MyChannelItem, self).__init__(parent)
        self.resize(572, 111)

        self.setStyleSheet((
            "QPushButton[objectName=\"pushButton\"],QPushButton[objectName=\"pushButton_2\"],QPushButton[objectName=\"pushButton_3\"],QPushButton[objectName=\"pushButton_4\"],QPushButton[objectName=\"pushButton_5\"]{\n"
            "color: rgb(255, 0, 0);\n"
            "border:0px;\n"
            "}\n"
            "QToolButton[objectName=\"closetoolButton\"] {\n"
            "border:0px;\n"
            "}\n"
            "QToolButton[objectName=\"closetoolButton\"]:hover {\n"
            "image:url(:/images/close_hover.png);\n"
            "}\n"
            "QToolButton[objectName=\"closetoolButton\"]:pressed {\n"
            "image:url(:/images/close_pressed.png);\n"
            "}"))
        self.label = QtGui.QLabel(self)
        self.label.setGeometry(QtCore.QRect(30, 20, 60, 60))
        self.label.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.label.setText((""))
        self.label.setPixmap(QtGui.QPixmap((":/images/channel_default.png")))
        self.label.setAlignment(QtCore.Qt.AlignCenter)
        self.label.setObjectName(("label"))
        self.label_2 = QtGui.QLabel(self)
        self.label_2.setGeometry(QtCore.QRect(110, 50, 54, 12))
        self.label_2.setObjectName(("label_2"))
        self.label_4 = scrollTextLabel(self)
        self.label_4.setGeometry(QtCore.QRect(110, 10, 110, 12))
        self.label_4.setObjectName(("label_4"))
        self.label_5 = QtGui.QLabel(self)
        self.label_5.setGeometry(QtCore.QRect(110, 30, 54, 12))
        self.label_5.setObjectName(("label_5"))

        #         self.label_6 = QtGui.QLabel(self)
        #         self.label_6.setGeometry(QtCore.QRect(160, 30, 68, 12))
        #         self.label_6.setObjectName(("label_6"))
        #         self.label_6.setToolTip("11111111111")

        self.label_6 = QtGui.QLineEdit(self)
        self.label_6.setGeometry(QtCore.QRect(160, 30, 68, 12))
        self.label_6.setObjectName(("label_6"))
        self.label_6.setStyleSheet("border:0px;background-color:transparent;")
        self.label_6.setReadOnly(True)
        #         self.label_6.setCursorPosition(0)
        #         self.label_6.setAlignment(QtCore.Qt.AlignLeft)

        self.line = QtGui.QFrame(self)
        self.line.setGeometry(QtCore.QRect(220, 10, 16, 91))
        self.line.setFrameShape(QtGui.QFrame.VLine)
        self.line.setFrameShadow(QtGui.QFrame.Sunken)
        self.line.setObjectName(("line"))
        self.label_9 = QtGui.QLabel(self)
        self.label_9.setGeometry(QtCore.QRect(260, 50, 31, 16))
        self.label_9.setObjectName(("label_9"))
        self.lineEdit = QtGui.QLineEdit(self)
        self.lineEdit.setGeometry(QtCore.QRect(310, 50, 181, 20))
        self.lineEdit.setReadOnly(True)
        self.lineEdit.setObjectName(("lineEdit"))
        self.lineEdit_2 = QtGui.QLineEdit(self)
        self.lineEdit_2.setGeometry(QtCore.QRect(310, 80, 181, 20))
        self.lineEdit_2.setObjectName(("lineEdit_2"))
        self.label_10 = QtGui.QLabel(self)
        self.label_10.setGeometry(QtCore.QRect(260, 80, 31, 16))
        self.label_10.setObjectName(("label_10"))
        self.line_2 = QtGui.QFrame(self)
        self.line_2.setGeometry(QtCore.QRect(0, 0, 572, 1))
        self.line_2.setFrameShape(QtGui.QFrame.HLine)
        self.line_2.setFrameShadow(QtGui.QFrame.Sunken)
        self.line_2.setObjectName(("line_2"))
        self.line_3 = QtGui.QFrame(self)
        self.line_3.setGeometry(QtCore.QRect(0, 110, 572, 1))
        self.line_3.setFrameShape(QtGui.QFrame.HLine)
        self.line_3.setFrameShadow(QtGui.QFrame.Sunken)
        self.line_3.setObjectName(("line_3"))
        self.pushButton = channelItem_pushButton(self)
        self.pushButton.setGeometry(QtCore.QRect(165, 50, 49, 12))
        font = QtGui.QFont()
        font.setFamily(("Aharoni"))
        font.setBold(True)
        font.setUnderline(True)
        font.setWeight(75)
        self.pushButton.setFont(font)
        self.pushButton.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
        self.pushButton.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.pushButton.setStyleSheet((""))
        self.pushButton.setObjectName(("pushButton"))
        self.pushButton_2 = QtGui.QPushButton(self)
        self.pushButton_2.setGeometry(QtCore.QRect(432, 17, 60, 21))
        font = QtGui.QFont()
        font.setFamily(("Aharoni"))
        font.setBold(True)
        font.setUnderline(True)
        font.setWeight(75)
        self.pushButton_2.setFont(font)
        self.pushButton_2.setCursor(QtGui.QCursor(
            QtCore.Qt.PointingHandCursor))
        self.pushButton_2.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.pushButton_2.setStyleSheet((""))
        self.pushButton_2.setObjectName(("pushButton_2"))
        self.pushButton_3 = QtGui.QPushButton(self)
        self.pushButton_3.setGeometry(QtCore.QRect(255, 17, 60, 21))
        font = QtGui.QFont()
        font.setFamily(("Aharoni"))
        font.setBold(True)
        font.setUnderline(True)
        font.setWeight(75)
        self.pushButton_3.setFont(font)
        self.pushButton_3.setCursor(QtGui.QCursor(
            QtCore.Qt.PointingHandCursor))
        self.pushButton_3.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.pushButton_3.setStyleSheet((""))
        self.pushButton_3.setObjectName(("pushButton_3"))
        self.pushButton_4 = QtGui.QPushButton(self)
        self.pushButton_4.setGeometry(QtCore.QRect(165, 70, 41, 12))
        font = QtGui.QFont()
        font.setFamily(("Aharoni"))
        font.setBold(True)
        font.setUnderline(True)
        font.setWeight(75)
        self.pushButton_4.setFont(font)
        self.pushButton_4.setCursor(QtGui.QCursor(
            QtCore.Qt.PointingHandCursor))
        self.pushButton_4.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.pushButton_4.setStyleSheet((""))
        self.pushButton_4.setObjectName(("pushButton_4"))
        self.label_3 = QtGui.QLabel(self)
        self.label_3.setGeometry(QtCore.QRect(110, 70, 54, 12))
        self.label_3.setObjectName(("label_3"))
        self.label_11 = QtGui.QLabel(self)
        self.label_11.setGeometry(QtCore.QRect(30, 90, 60, 12))
        self.label_11.setAlignment(QtCore.Qt.AlignCenter)
        self.label_11.setObjectName(("label_11"))
        self.label_12 = QtGui.QLabel(self)
        self.label_12.setGeometry(QtCore.QRect(110, 90, 110, 12))
        self.label_12.setText((""))
        self.label_12.setObjectName(("label_12"))
        self.closetoolButton = QtGui.QToolButton(self)
        self.closetoolButton.setGeometry(QtCore.QRect(540, 2, 27, 22))
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap((":/images/close_normal.png")),
                       QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.closetoolButton.setIcon(icon)
        self.closetoolButton.setIconSize(QtCore.QSize(27, 22))
        self.closetoolButton.setObjectName(("closetoolButton"))

        #         self.label.setText(u"游戏图片")
        self.label_2.setText(u"渠道版本:")
        self.label_4.setText(u"渠道名")
        self.label_5.setText(u"渠道号:")
        self.label_6.setText(u"渠道号")
        self.label_9.setText(u"包名")
        self.label_10.setText(u"签名")
        self.pushButton.setText(u"版本号")
        self.pushButton_2.setText(u"设置")
        self.pushButton_3.setText(u"闪屏预览")
        self.pushButton_4.setText(u"详情")
        self.label_3.setText(u"插件详情:")
        self.label_11.setText(u"备注:")

        logDir = 'Log/'
        productcode = ConfigParse.shareInstance().getProductCode()
        logFile = codecs.open(logDir + productcode + '/SignFile.log', 'a+',
                              'utf-8')
        for line in logFile.readlines():
            line = line.rstrip("\r\n")  #此处需要去掉隐藏的\r\n,才能匹配
            idx = line.find('|Default')
            if idx > 0:
                Info = line.split('|')
                self.lineEdit_2.setText(
                    file_operate.getFullPath(unicode(Info[0])))
                break
Exemplo n.º 14
0
class Ui_Dialog_efuntw(object):
    def setupUi(self, Dialog_efuntw):
        Dialog_efuntw.setObjectName(_fromUtf8("Dialog_efuntw"))
        Dialog_efuntw.resize(624, 481)
        self.groupBox_2 = QtGui.QGroupBox(Dialog_efuntw)
        self.groupBox_2.setGeometry(QtCore.QRect(20, 260, 581, 121))
        self.groupBox_2.setObjectName(_fromUtf8("groupBox_2"))
        self.label_7 = QtGui.QLabel(self.groupBox_2)
        self.label_7.setGeometry(QtCore.QRect(10, 30, 54, 12))
        self.label_7.setObjectName(_fromUtf8("label_7"))
        self.label_8 = QtGui.QLabel(self.groupBox_2)
        self.label_8.setGeometry(QtCore.QRect(10, 60, 71, 16))
        self.label_8.setObjectName(_fromUtf8("label_8"))
        self.label_9 = QtGui.QLabel(self.groupBox_2)
        self.label_9.setGeometry(QtCore.QRect(10, 90, 71, 16))
        self.label_9.setObjectName(_fromUtf8("label_9"))
        self.label_10 = QtGui.QLabel(self.groupBox_2)
        self.label_10.setGeometry(QtCore.QRect(290, 60, 81, 16))
        self.label_10.setObjectName(_fromUtf8("label_10"))
        self.label_11 = QtGui.QLabel(self.groupBox_2)
        self.label_11.setGeometry(QtCore.QRect(290, 90, 71, 16))
        self.label_11.setObjectName(_fromUtf8("label_11"))
        self.label_12 = QtGui.QLabel(self.groupBox_2)
        self.label_12.setGeometry(QtCore.QRect(290, 30, 61, 16))
        self.label_12.setObjectName(_fromUtf8("label_12"))
        self.gameId = QtGui.QLineEdit(self.groupBox_2)
        self.gameId.setGeometry(QtCore.QRect(80, 20, 181, 20))
        self.gameId.setObjectName(_fromUtf8("gameId"))
        self.appVersion = QtGui.QLineEdit(self.groupBox_2)
        self.appVersion.setGeometry(QtCore.QRect(80, 50, 181, 20))
        self.appVersion.setObjectName(_fromUtf8("appVersion"))
        self.datacenter = QtGui.QLineEdit(self.groupBox_2)
        self.datacenter.setGeometry(QtCore.QRect(80, 80, 181, 20))
        self.datacenter.setObjectName(_fromUtf8("datacenter"))
        self.resVersion = QtGui.QLineEdit(self.groupBox_2)
        self.resVersion.setGeometry(QtCore.QRect(370, 80, 161, 20))
        self.resVersion.setObjectName(_fromUtf8("resVersion"))
        self.platformId = QtGui.QLineEdit(self.groupBox_2)
        self.platformId.setGeometry(QtCore.QRect(370, 20, 161, 20))
        self.platformId.setObjectName(_fromUtf8("platformId"))
        self.platformType = QtGui.QLineEdit(self.groupBox_2)
        self.platformType.setGeometry(QtCore.QRect(370, 50, 161, 20))
        self.platformType.setObjectName(_fromUtf8("platformType"))
        self.groupBox = QtGui.QGroupBox(Dialog_efuntw)
        self.groupBox.setGeometry(QtCore.QRect(20, 20, 581, 211))
        self.groupBox.setObjectName(_fromUtf8("groupBox"))
        self.label_1 = QtGui.QLabel(self.groupBox)
        self.label_1.setGeometry(QtCore.QRect(10, 20, 61, 20))
        self.label_1.setObjectName(_fromUtf8("label_1"))
        self.gameName = QtGui.QLineEdit(self.groupBox)
        self.gameName.setGeometry(QtCore.QRect(130, 20, 291, 20))
        self.gameName.setObjectName(_fromUtf8("gameName"))
        self.label_2 = QtGui.QLabel(self.groupBox)
        self.label_2.setGeometry(QtCore.QRect(10, 50, 81, 20))
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.channelType = QtGui.QLineEdit(self.groupBox)
        self.channelType.setGeometry(QtCore.QRect(130, 50, 291, 20))
        self.channelType.setObjectName(_fromUtf8("channelType"))
        self.label_3 = QtGui.QLabel(self.groupBox)
        self.label_3.setGeometry(QtCore.QRect(10, 110, 111, 20))
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self.efunGameShortName = QtGui.QLineEdit(self.groupBox)
        self.efunGameShortName.setGeometry(QtCore.QRect(130, 110, 291, 20))
        self.efunGameShortName.setObjectName(_fromUtf8("efunGameShortName"))
        self.label_4 = QtGui.QLabel(self.groupBox)
        self.label_4.setGeometry(QtCore.QRect(430, 112, 131, 20))
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self.label_5 = QtGui.QLabel(self.groupBox)
        self.label_5.setGeometry(QtCore.QRect(10, 140, 111, 20))
        self.label_5.setObjectName(_fromUtf8("label_5"))
        self.efunAppKey = QtGui.QLineEdit(self.groupBox)
        self.efunAppKey.setGeometry(QtCore.QRect(130, 140, 291, 20))
        self.efunAppKey.setObjectName(_fromUtf8("efunAppKey"))
        self.label_6 = QtGui.QLabel(self.groupBox)
        self.label_6.setGeometry(QtCore.QRect(430, 140, 151, 16))
        self.label_6.setObjectName(_fromUtf8("label_6"))
        self.label = QtGui.QLabel(self.groupBox)
        self.label.setGeometry(QtCore.QRect(10, 80, 81, 20))
        self.label.setObjectName(_fromUtf8("label"))
        self.efunGameCode = QtGui.QLineEdit(self.groupBox)
        self.efunGameCode.setGeometry(QtCore.QRect(130, 80, 291, 20))
        self.efunGameCode.setObjectName(_fromUtf8("efunGameCode"))
        self.label_14 = QtGui.QLabel(self.groupBox)
        self.label_14.setGeometry(QtCore.QRect(430, 80, 91, 16))
        self.label_14.setObjectName(_fromUtf8("label_14"))
        self.label_15 = QtGui.QLabel(self.groupBox)
        self.label_15.setGeometry(QtCore.QRect(430, 50, 181, 16))
        self.label_15.setObjectName(_fromUtf8("label_15"))
        self.label_16 = QtGui.QLabel(self.groupBox)
        self.label_16.setGeometry(QtCore.QRect(10, 170, 131, 16))
        self.label_16.setObjectName(_fromUtf8("label_16"))
        self.efunAnnouncementCode = QtGui.QLineEdit(self.groupBox)
        self.efunAnnouncementCode.setGeometry(QtCore.QRect(130, 170, 291, 20))
        self.efunAnnouncementCode.setObjectName(
            _fromUtf8("efunAnnouncementCode"))
        self.label_13 = QtGui.QLabel(Dialog_efuntw)
        self.label_13.setGeometry(QtCore.QRect(20, 400, 54, 12))
        self.label_13.setObjectName(_fromUtf8("label_13"))
        self.packageName = QtGui.QLineEdit(Dialog_efuntw)
        self.packageName.setGeometry(QtCore.QRect(60, 400, 541, 20))
        self.packageName.setObjectName(_fromUtf8("packageName"))
        self.pushButton = QtGui.QPushButton(Dialog_efuntw)
        self.pushButton.setGeometry(QtCore.QRect(260, 440, 75, 23))
        self.pushButton.setObjectName(_fromUtf8("pushButton"))

        self.retranslateUi(Dialog_efuntw)
        QtCore.QMetaObject.connectSlotsByName(Dialog_efuntw)

        QtCore.QObject.connect(self.pushButton,
                               QtCore.SIGNAL(_fromUtf8("clicked()")),
                               Dialog_efuntw.onOkClicked)
        self.initDialog()

    def initDialog(self):
        try:
            #read form ForManifest.xml
            ET.register_namespace('android', constant.androidNS)

            #渠道信息
            config = ET.parse(file_operate.getConfigXmlPath())
            root = config.getroot()

            #平台信息
            platform = root.find("platform")
            self.gameId.setText(platform.get("gameId"))
            self.platformId.setText(platform.get("platformId"))
            self.appVersion.setText(platform.get("appVersion"))
            self.platformType.setText(platform.get("platformType"))
            self.datacenter.setText(platform.get("datacenter"))

            app = root.find("app")
            self.packageName.setText(app.get("packageName"))

            channel = root.find("channel")
            self.gameName.setText(channel.get("gameName"))
            self.channelType.setText(channel.get("channelType"))

            if channel.get("resVersion") != None:
                self.resVersion.setText(channel.get("resVersion"))
            else:
                self.resVersion.setText("")
        except Exception, e:
            print e
            print "Error: cannot parse file: funcellconfig.xml."
            return -1

        try:
            efunGameConfig = ET.parse(
                file_operate.getFullPath(
                    constant.sdkRelatePath +
                    ConfigParse.shareInstance().getChannelName() +
                    "/ForRes/values/efunGameConfig.xml"))

            efunGameConfigRoot = efunGameConfig.getroot()

            for efunGameConfigNode in efunGameConfigRoot:
                if efunGameConfigNode.attrib['name'] == "efunGameCode":
                    self.efunGameCode.setText(efunGameConfigNode.text)

                if efunGameConfigNode.attrib['name'] == "efunGameShortName":
                    self.efunGameShortName.setText(efunGameConfigNode.text)

                if efunGameConfigNode.attrib['name'] == "efunAppKey":
                    self.efunAppKey.setText(efunGameConfigNode.text)

                if efunGameConfigNode.attrib['name'] == "efunAnnouncementCode":
                    self.efunAnnouncementCode.setText(efunGameConfigNode.text)

        except Exception, e:
            print e
            print "Error: cannot parse file: efunGameConfig.xml."
            return -1
Exemplo n.º 15
0
class Ui_Dialog_tw_zhiyou(object):
    def setupUi(self, Dialog_tw_zhiyou):
        Dialog_tw_zhiyou.setObjectName(_fromUtf8("Dialog_tw_zhiyou"))
        Dialog_tw_zhiyou.resize(643, 416)
        self.groupBox_2 = QtGui.QGroupBox(Dialog_tw_zhiyou)
        self.groupBox_2.setGeometry(QtCore.QRect(30, 190, 581, 121))
        self.groupBox_2.setObjectName(_fromUtf8("groupBox_2"))
        self.label_7 = QtGui.QLabel(self.groupBox_2)
        self.label_7.setGeometry(QtCore.QRect(10, 30, 54, 12))
        self.label_7.setObjectName(_fromUtf8("label_7"))
        self.label_8 = QtGui.QLabel(self.groupBox_2)
        self.label_8.setGeometry(QtCore.QRect(10, 60, 71, 16))
        self.label_8.setObjectName(_fromUtf8("label_8"))
        self.label_9 = QtGui.QLabel(self.groupBox_2)
        self.label_9.setGeometry(QtCore.QRect(10, 90, 71, 16))
        self.label_9.setObjectName(_fromUtf8("label_9"))
        self.label_10 = QtGui.QLabel(self.groupBox_2)
        self.label_10.setGeometry(QtCore.QRect(290, 60, 81, 16))
        self.label_10.setObjectName(_fromUtf8("label_10"))
        self.label_11 = QtGui.QLabel(self.groupBox_2)
        self.label_11.setGeometry(QtCore.QRect(290, 90, 71, 16))
        self.label_11.setObjectName(_fromUtf8("label_11"))
        self.label_12 = QtGui.QLabel(self.groupBox_2)
        self.label_12.setGeometry(QtCore.QRect(290, 30, 61, 16))
        self.label_12.setObjectName(_fromUtf8("label_12"))
        self.gameId = QtGui.QLineEdit(self.groupBox_2)
        self.gameId.setGeometry(QtCore.QRect(80, 20, 181, 20))
        self.gameId.setObjectName(_fromUtf8("gameId"))
        self.appVersion = QtGui.QLineEdit(self.groupBox_2)
        self.appVersion.setGeometry(QtCore.QRect(80, 50, 181, 20))
        self.appVersion.setObjectName(_fromUtf8("appVersion"))
        self.datacenter = QtGui.QLineEdit(self.groupBox_2)
        self.datacenter.setGeometry(QtCore.QRect(80, 80, 181, 20))
        self.datacenter.setObjectName(_fromUtf8("datacenter"))
        self.resVersion = QtGui.QLineEdit(self.groupBox_2)
        self.resVersion.setGeometry(QtCore.QRect(370, 80, 161, 20))
        self.resVersion.setObjectName(_fromUtf8("resVersion"))
        self.platformId = QtGui.QLineEdit(self.groupBox_2)
        self.platformId.setGeometry(QtCore.QRect(370, 20, 161, 20))
        self.platformId.setObjectName(_fromUtf8("platformId"))
        self.platformType = QtGui.QLineEdit(self.groupBox_2)
        self.platformType.setGeometry(QtCore.QRect(370, 50, 161, 20))
        self.platformType.setObjectName(_fromUtf8("platformType"))
        self.packageName = QtGui.QLineEdit(Dialog_tw_zhiyou)
        self.packageName.setGeometry(QtCore.QRect(70, 330, 541, 20))
        self.packageName.setObjectName(_fromUtf8("packageName"))
        self.pushButton = QtGui.QPushButton(Dialog_tw_zhiyou)
        self.pushButton.setGeometry(QtCore.QRect(270, 370, 75, 23))
        self.pushButton.setObjectName(_fromUtf8("pushButton"))
        self.groupBox = QtGui.QGroupBox(Dialog_tw_zhiyou)
        self.groupBox.setGeometry(QtCore.QRect(30, 20, 581, 151))
        self.groupBox.setObjectName(_fromUtf8("groupBox"))
        self.label_1 = QtGui.QLabel(self.groupBox)
        self.label_1.setGeometry(QtCore.QRect(10, 20, 61, 20))
        self.label_1.setObjectName(_fromUtf8("label_1"))
        self.appKey = QtGui.QLineEdit(self.groupBox)
        self.appKey.setGeometry(QtCore.QRect(130, 20, 291, 20))
        self.appKey.setObjectName(_fromUtf8("appKey"))
        self.label_2 = QtGui.QLabel(self.groupBox)
        self.label_2.setGeometry(QtCore.QRect(10, 50, 101, 20))
        self.label_2.setObjectName(_fromUtf8("label_2"))
        self.statisticsAppId = QtGui.QLineEdit(self.groupBox)
        self.statisticsAppId.setGeometry(QtCore.QRect(130, 50, 291, 20))
        self.statisticsAppId.setObjectName(_fromUtf8("statisticsAppId"))
        self.label_3 = QtGui.QLabel(self.groupBox)
        self.label_3.setGeometry(QtCore.QRect(10, 110, 111, 20))
        self.label_3.setObjectName(_fromUtf8("label_3"))
        self.screenOrientation = QtGui.QLineEdit(self.groupBox)
        self.screenOrientation.setGeometry(QtCore.QRect(130, 110, 291, 20))
        self.screenOrientation.setObjectName(_fromUtf8("screenOrientation"))
        self.label_4 = QtGui.QLabel(self.groupBox)
        self.label_4.setGeometry(QtCore.QRect(430, 112, 131, 20))
        self.label_4.setObjectName(_fromUtf8("label_4"))
        self.label = QtGui.QLabel(self.groupBox)
        self.label.setGeometry(QtCore.QRect(10, 80, 81, 20))
        self.label.setObjectName(_fromUtf8("label"))
        self.facebookid = QtGui.QLineEdit(self.groupBox)
        self.facebookid.setGeometry(QtCore.QRect(130, 80, 291, 20))
        self.facebookid.setObjectName(_fromUtf8("facebookid"))
        self.label_13 = QtGui.QLabel(Dialog_tw_zhiyou)
        self.label_13.setGeometry(QtCore.QRect(30, 330, 54, 12))
        self.label_13.setObjectName(_fromUtf8("label_13"))

        self.retranslateUi(Dialog_tw_zhiyou)
        QtCore.QMetaObject.connectSlotsByName(Dialog_tw_zhiyou)

        QtCore.QObject.connect(self.pushButton,
                               QtCore.SIGNAL(_fromUtf8("clicked()")),
                               Dialog_tw_zhiyou.onOkClicked)
        self.initDialog()

    def initDialog(self):
        try:
            #read form ForManifest.xml
            ET.register_namespace('android', constant.androidNS)

            #渠道信息
            config = ET.parse(file_operate.getConfigXmlPath())
            root = config.getroot()

            #平台信息
            platform = root.find("platform")
            self.gameId.setText(platform.get("gameId"))
            self.platformId.setText(platform.get("platformId"))
            self.appVersion.setText(platform.get("appVersion"))
            self.platformType.setText(platform.get("platformType"))
            self.datacenter.setText(platform.get("datacenter"))

            app = root.find("app")
            self.packageName.setText(app.get("packageName"))

            channel = root.find("channel")
            self.appKey.setText(channel.get("appKey"))
            self.statisticsAppId.setText(channel.get("statisticsAppId"))
            self.screenOrientation.setText(channel.get("screenOrientation"))
            #             self.facebookid.setText(channel.get("facebookid"))

            if channel.get("resVersion") != None:
                self.resVersion.setText(channel.get("resVersion"))
            else:
                self.resVersion.setText("")
        except Exception, e:
            print e
            print "Error: cannot parse file: funcellconfig.xml."
            return -1

        try:
            valuesConfig = ET.parse(
                file_operate.getFullPath(
                    constant.sdkRelatePath +
                    ConfigParse.shareInstance().getChannelName() +
                    "/ForRes/values/values.xml"))
            valuesConfigRoot = valuesConfig.getroot()
            stringNodeList = valuesConfigRoot.findall("string")
            for stringNode in stringNodeList:
                if stringNode.attrib['name'] == "gamexdd_fb_app_id":
                    self.facebookid.setText(stringNode.text)

        except Exception, e:
            print e
            print "Error: cannot parse file: values.xml."
            return -1
Exemplo n.º 16
0
    def onOkClicked(self):
        try:
            #print os.path.abspath('.')
            config = ET.parse(file_operate.getConfigXmlPath())
            root = config.getroot()

            #渠道信息
            channel = root.find("channel")
            channel.set("appId", unicode(self.lineEdit.text()))
            channel.set("appKey", unicode(self.lineEdit_2.text()))
            channel.set("wxAppId", unicode(self.lineEdit_3.text()))
            channel.set("wxAppKey", unicode(self.lineEdit_4.text())) 
            channel.set("isRelease", unicode(self.comboBox.currentText())) 
            channel.set("resVersion", unicode(self.lineEdit_10.text()))
            channel.set("msdkKey", unicode(self.msdkKey.text()))
            channel.set("TA_APPKEY", unicode(self.TA_APPKEY.text()))
            channel.set("InstallChannel", unicode(self.InstallChannel.text()))
            
            #平台信息
            platform = root.find("platform")
            platform.set("gameId", unicode(self.lineEdit_5.text()))
            platform.set("platformId", unicode(self.lineEdit_6.text()))
            platform.set("appVersion", unicode(self.lineEdit_7.text()))
            platform.set("platformType", unicode(self.lineEdit_8.text()))
            platform.set("datacenter", unicode(self.lineEdit_9.text()))
            
            app = root.find("app")
            app.set("packageName", unicode(self.lineEdit_11.text()))

            config.write(file_operate.getConfigXmlPath(), "utf-8")
            
            #write appid wxappid to ForManifest
            doc = minidom.parse(file_operate.getForManifestXmlPath())
            rootNode = doc.documentElement
            applicationList = rootNode.getElementsByTagName("applicationCfg")
            for applicationNode in applicationList:
                activityList = rootNode.getElementsByTagName('activity')
                for activityNode in activityList:
                    if activityNode.getAttribute('android:name') == 'com.tencent.tauth.AuthActivity':
                        dataList = activityNode.getElementsByTagName("data")
                        for dataNode in dataList:
                            dataNode.setAttribute('android:scheme', "tencent"+unicode(self.lineEdit.text()))
                metaConfigList = applicationNode.getElementsByTagName("meta-data")
                for child in metaConfigList:
                    if child.getAttribute('android:name') == "TA_APPKEY":
                        child.setAttribute('android:value', unicode(self.TA_APPKEY.text()))
                    if child.getAttribute('android:name') == "InstallChannel":
                        child.setAttribute('android:value', unicode(self.InstallChannel.text()))

            f = codecs.open(file_operate.getForManifestXmlPath(), 'w', 'utf-8')
            doc.writexml(f, encoding='utf-8')
            f.close()
            
            #modify assets msdkconfig.ini
            configiniPath = getFullPath(constant.sdkRelatePath + ConfigParse.shareInstance().getChannelName()+"/ForAssets/msdkconfig.ini")
            msdk = codecs.open(configiniPath, 'w')
            configInfo = 'AMS_CENTER_URL=http://apps.game.qq.com/ams/ame/gac.php?returntype=html\n'
            configInfo += 'MSDK_URL='
            if self.comboBox.currentText() == "debug":
                msdkUrl = "http://msdktest.qq.com"
            else:
                msdkUrl = "http://msdk.qq.com"
            configInfo += msdkUrl
            configInfo += '\n'
            configInfo += 'BETA=false\n'
            #configInfo += 'needNotice=false\n'
            #configInfo += 'noticeTime=10\n'
            #configInfo += 'PUSH=true\n'
            #configInfo += 'SAVE_UPDATE=true\n'
            configInfo += 'localLog=3\n'
            configInfo += 'STAT_LOG=true\n'
            configInfo += 'WXTOKEN_REFRESH=true'
            msdk.write(configInfo)
            msdk.flush()
            msdk.close()

        except Exception,e:
            print e
            print "Error: cannot parse file: config.xml."
            return -1
Exemplo n.º 17
0
def create_default_logs():
    cur_path = os.path.dirname(os.path.abspath("__file__"))
    default_log_path = os.path.join(cur_path, "logs")
    if not os.path.exists(default_log_path):
        os.mkdir(default_log_path)

    _app_log_file = os.path.join(default_log_path, "app.log")
    if not os.path.exists(_app_log_file):
        os.mknod(_app_log_file)

    _access_log_file = os.path.join(default_log_path, "access.log")
    if not os.path.exists(_access_log_file):
        os.mknod(_access_log_file)


Config = ConfigParse()

log_levels = {
    "debug": logging.DEBUG,
    "info": logging.INFO,
    "warn": logging.WARN,
    "error": logging.ERROR
}

_log_level = Config.logs.level or 'debug'
log_level = log_levels.get(_log_level, logging.DEBUG)

# debug模式下所有日志都输出到stdout
log_to_stdout = Config.server.debug == 'True'

if log_to_stdout: