Пример #1
0
 def savenauticalChart(self, JSONData):
     JSONData = json.dumps(JSONData, indent=4, sort_keys=False)
     options = QFileDialog.Options()
     filePath, _ = QFileDialog.getSaveFileName(self,
                                               self.translate("nauticalChartPanel", "Save V2Ray config.json File"),
                                               "config.json",
                                               """
                                               json file (*.json);;
                                               All Files (*)
                                               """,
                                               options=options)
     if (filePath):
         openV2rayJSONFile.openV2rayJSONFile().saveTextdata(filePath=filePath,
                                                            data=JSONData)
Пример #2
0
 def getProxyAddressFromJSONFile(self, filePath):
     from bridgehouse.editMap.port import treasureChest, openV2rayJSONFile
     tempTreasureChest = treasureChest.treasureChest()
     openV2rayJSONFile.openV2rayJSONFile(filePath, tempTreasureChest, disableLog = True).initboundJSONData()
     inbound   = tempTreasureChest.getInbound()
     if (inbound):
         protocol  = inbound["protocol"]
         ipAddress = inbound["listen"]
         port      = inbound["port"]
         if (protocol == "socks" or protocol == "http"):
             return "{}:{}:{}".format(protocol, ipAddress, port)
         else:
             return False
     else:
         return False
Пример #3
0
    def createPanel(self):
        hboxButton = QHBoxLayout()
        btnSave = QPushButton(self.translate("nauticalChartPanel", "Save"))
        btnExit = QPushButton(self.translate("nauticalChartPanel", "Exit"))
        self.groupButtonConfigure = QButtonGroup()
        self.groupButtonConfigure.addButton(btnSave)
        self.groupButtonConfigure.addButton(btnExit)

        hboxButton.addStretch()
        hboxButton.addWidget(btnSave)
        hboxButton.addWidget(btnExit)

        self.inbound = inboundPanel.InboundPanel(self.treasureChest)
        self.outbound = outboundPanel.OutboundPanel(self.treasureChest)

        tabWidgetConfigurePanel = QTabWidget()
        tabWidgetConfigurePanel.addTab(
            self.inbound.createInboundPanel(),
            self.translate("nauticalChartPanel", "Inbound"))
        tabWidgetConfigurePanel.addTab(
            self.outbound.createOutboundPanel(),
            self.translate("nauticalChartPanel", "Outbound"))

        self.transportTAB = transportTAB.transportTab()
        tabWidgetConfigurePanel.addTab(
            self.transportTAB.createTransportPanel(),
            self.translate("nauticalChartPanel", "Transport Setting"))

        self.dnsTAB = dnsTAB.dnsTab()
        tabWidgetConfigurePanel.addTab(
            self.dnsTAB.createDnsTab(),
            self.translate("nauticalChartPanel", "DNS Server"))

        self.routingTAB = routingTAB.routingTab()
        tabWidgetConfigurePanel.addTab(
            self.routingTAB.createRoutingTab(),
            self.translate("nauticalChartPanel", "Router Setting"))

        self.policyTAB = policyTAB.policyTab(self.treasureChest)
        tabWidgetConfigurePanel.addTab(
            self.policyTAB.createPolicyTab(),
            self.translate("nauticalChartPanel", "Policy"))

        self.logTAB = logTAB.logTab()
        tabWidgetConfigurePanel.addTab(
            self.logTAB.createLogTab(),
            self.translate("nauticalChartPanel", "Log Files"))

        self.apiTAB = apiTAB.apiTAB()
        tabWidgetConfigurePanel.addTab(self.apiTAB.createapiTAB(), "Api")

        vboxConfigure = QVBoxLayout()
        vboxConfigure.addWidget(tabWidgetConfigurePanel)
        vboxConfigure.addLayout(hboxButton)
        self.ScrollLayout(vboxConfigure)

        if (v2rayshellDebug):
            self.__debugBtn = QPushButton("__debugTest", self)
            self.__debugRefresh = QPushButton("__RefreshTest", self)
            self.__printTags = QPushButton("__PrintTags", self)
            self.__printAllLevels = QPushButton("__PrintAllLevels", self)
            self.__printAllEmails = QPushButton("__PrintAllEmails", self)

            hboxBtn = QHBoxLayout(self)
            hboxBtn.addWidget(self.__debugBtn)
            hboxBtn.addWidget(self.__printTags)
            hboxBtn.addWidget(self.__printAllLevels)
            hboxBtn.addWidget(self.__printAllEmails)
            hboxBtn.addWidget(self.__debugRefresh)
            vboxConfigure.addLayout(hboxBtn)

            self.__debugBtn.clicked.connect(self.__debugTest)
            self.__debugRefresh.clicked.connect(self.__debugRefreshTest)
            self.__printTags.clicked.connect(
                lambda: print(self.treasureChest.getAllTags()))
            self.__printAllLevels.clicked.connect(
                lambda: print(self.treasureChest.getLevels()))
            self.__printAllEmails.clicked.connect(
                lambda: print(self.treasureChest.getEmails()))

            self.editV2rayJSONFile = openV2rayJSONFile.editV2rayJSONFile(
                self.treasureChest)
            tabWidgetConfigurePanel.addTab(
                self.editV2rayJSONFile.createPanel(), "open V2ray File")
            self.settingv2rayshellPanelFromJSONFile(True)

        if (self.filePath):
            openV2rayJSONFile.openV2rayJSONFile(
                self.filePath, self.treasureChest).initboundJSONData()
            self.settingv2rayshellPanelFromJSONFile(openFromJSONFile=True)

        self.createPanelSignals()