コード例 #1
0
ファイル: xCELL.py プロジェクト: Beezusburger/JaSONx
def search_json(path, diz_xml):
    global environment_prefix
    file_list = utility.createListFile(path, ".json")
    diz_meters = {}
    environment_prefix = ""
    count = 0
    for file in file_list:
        file_json = utility.readFileJSON(os.path.join(path, file))

        if (count == 0):
            environment_prefix = file_json["parameters"]["environment_prefix"]
            count += 1
        meter_name = file_json["parameters"]["meter_name"]
        for key in file_json["parameters"]["filter_tag"]:
            if (key["tag"] != "CommunicationCode"):
                if (meter_name not in diz_meters):
                    diz_meters[meter_name] = []
                diz_meters[meter_name] += [{
                    key["tag"][key["tag"].find(".") + 1:]: {
                        "id": key["id"],
                        "period": key["period"],
                        "name": diz_xml[key["tag"]]
                    }
                }]
    return ([diz_meters, environment_prefix])
コード例 #2
0
ファイル: configuration.py プロジェクト: Beezusburger/JaSONx
def add_file_hierarchy(path):
    if (os.path.isfile(path)
            and utility.getSubstring(path, start=".") == "xml"):
        shutil.copy(path, hierarchyPath)
        return True
    elif (os.path.isdir(path)):
        list_files = utility.createListFile(path, ".xml")
        for file in list_files:
            shutil.copy(os.path.join(path, file), hierarchyPath)
        return True
    else:
        return False
コード例 #3
0
ファイル: configuration.py プロジェクト: Beezusburger/JaSONx
def add_json_template(path):
    file_path = os.path.basename(path)
    if (os.path.isfile(path)
            and utility.getSubstring(path, start=".") == "json"):
        path_name, file_name = os.path.splitext(file_path)
        shutil.copy(path, templatesPath)
        utility.add_measures_template(file_path)
        return True
    elif (os.path.isdir(path)):
        list_files = utility.createListFile(path, ".json")
        for file in list_files:
            shutil.copy(os.path.join(path, file), templatesPath)
        utility.add_measures_template(list_files)
        return True
    else:
        return False
コード例 #4
0
 def __init__(self, parent=None):
     super(actThingMainInterface, self).__init__(parent)
     '''Window settings'''
     self.setWindowTitle("actTHING")
     self.setFixedSize(1050, 600)
     scriptDir = os.path.dirname(os.path.realpath(__file__))
     self.setWindowIcon(
         QtGui.QIcon(scriptDir + os.path.sep + 'image\\image.png'))
     '''Font settings'''
     font = QtGui.QFont()
     font.setPointSize(13)
     self.setFont(font)
     '''Button settings'''
     self.button = QtWidgets.QPushButton("Activate Things")
     self.button.setStyleSheet(
         "background-color: orange; color: white; height:50; border-radius:10"
     )
     self.button.setFont(font)
     '''Create list file .json'''
     self.list_file_json = utility.createListFile(
         JaSONx.jsonPath + JaSONx.name_file_hierarchy[:-4], ".json")
     '''Layout settings'''
     grid = QtWidgets.QGridLayout()
     self.table = QtWidgets.QTableWidget()
     self.table.setFont(font)
     self.table.setRowCount(len(self.list_file_json))
     self.table.setColumnCount(1)
     self.table.setHorizontalHeaderLabels(["File JSON"])
     self.table.setColumnWidth(0, 1000)
     '''Grid Layout'''
     grid.addWidget(self.table, 0, 0)
     grid.addWidget(self.button, 1, 0)
     '''Layout QWidget'''
     layout = QtWidgets.QWidget()
     layout.setLayout(grid)
     '''Layout QMainWindow'''
     self.setCentralWidget(layout)
     '''Table settings'''
     count = 0
     for file in self.list_file_json:
         self.table.setItem(count, 0, QtWidgets.QTableWidgetItem(file))
         count += 1
     '''Button clicked'''
     self.button.clicked.connect(self.on_pushButton_clicked)
コード例 #5
0
ファイル: xCELL.py プロジェクト: Beezusburger/JaSONx
def search_json(path):
    global environment_prefix
    file_list = utility.createListFile(path)
    diz_meters = {}
    for file in file_list:
        file_json = utility.readFileJSON(path + "\\", file)
        meter_name = file_json["parameters"]["meter_name"]
        for key in file_json["parameters"]["filter_tag"]:
            environment_prefix = file_json["parameters"]["environment_prefix"]
            if (key["tag"] != "CommunicationCode"):
                if (meter_name not in diz_meters):
                    diz_meters[meter_name] = []
                else:
                    diz_meters[meter_name] += [{
                        key["tag"][key["tag"].find(".") + 1:]: {
                            "id": key["id"],
                            "period": key["period"]
                        }
                    }]
    return (diz_meters)
コード例 #6
0
    def __init__(self, parent=None):
        super(ACThingMainInterface, self).__init__(parent)
        
        '''Window settings'''
        self.setWindowTitle("actTHING")
        self.setFixedSize(1050,600) 
        scriptDir = os.path.dirname(os.path.realpath(__file__))
        self.setWindowIcon(QtGui.QIcon(scriptDir + os.path.sep + 'image\\acthing.png'))

        '''Font settings'''
        font = QtGui.QFont()
        font.setPointSize(13)
        fontToolbar = QtGui.QFont()
        fontToolbar.setPointSize(10)
        self.setFont(font)
        
        '''Button settings'''
        self.button = QtWidgets.QPushButton("Activate Things")
        self.button.setStyleSheet("background-color: orange; color: white; height:50; border-radius:10")
        self.button.setFont(font)
        
        '''Create list file .json'''
        self.list_file_json = utility.createListFile(os.path.join(JaSONx.jsonPath,JaSONx.name_file_hierarchy), ".json")
        
        '''Layout settings'''
        grid = QtWidgets.QGridLayout()   
        self.table = QtWidgets.QTableWidget()   
        self.table.setFont(font)               
        self.table.setRowCount(len(self.list_file_json))
        self.table.setColumnCount(1)
        self.table.setHorizontalHeaderLabels(["File JSON"])
        self.table.setColumnWidth(0,1000)

        '''Grid Layout'''
        grid.addWidget(self.table, 0, 0)
        grid.addWidget(self.button, 1, 0)
        
        '''Layout QWidget'''
        layout = QtWidgets.QWidget()
        layout.setLayout(grid)
        
        '''Layout QMainWindow'''
        self.setCentralWidget(layout)
        
        '''Toolbar'''
        toolbar = self.addToolBar('Toolbar')
        toolbar.setMovable(False)
        toolbar.setIconSize(QtCore.QSize(40,40))
        toolbar.setFont(fontToolbar)
        toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
        
        '''Icon toolbar'''
        '''Back application'''
        back_act = QtWidgets.QAction(QtGui.QIcon(os.path.join(os.path.realpath(''), "image", "icon","backicon.png")), 'Back', self)
        back_act.setShortcut('Ctrl+B')
        back_act.setStatusTip('Return to main Interface')
        
        '''Act toolbar'''
        toolbar.addAction(back_act)

        
        '''Toolbar triggered'''
        back_act.triggered.connect(self.returnFirstInterface)
  
        '''Table settings'''
        count = 0
        for file in self.list_file_json:
            self.table.setItem(count,0,QtWidgets.QTableWidgetItem(file))
            count +=1
            
        '''Button clicked'''
        self.button.clicked.connect(self.on_pushButton_clicked)
コード例 #7
0
def getListHierarchy():
    return(utility.createListFile(hierarchyPath, ".xml"))
コード例 #8
0
ファイル: xCELL.py プロジェクト: Beezusburger/JaSONx
def getListFolderJSON():
    return (utility.createListFile(jsonPath))