diff --git a/IsegHVController.py b/IsegHVController.py index 98284a4..79912f3 100755 --- a/IsegHVController.py +++ b/IsegHVController.py @@ -5,6 +5,7 @@ import os import datetime import csv import socket +import sys #assign a port, to prevent the script run mulitple time s = socket.socket() @@ -12,12 +13,19 @@ host = socket.gethostname() port = 4305 s.bind((host,port)) -IP = input('Mpod IP address to connect : ') +nArg = len(sys.argv) + +print ( nArg) + +if nArg > 1 : + IP = sys.argv[1] +else : + IP = input('Mpod IP address to connect : ') #===================== GUI import PySimpleGUI as sg -#gui.theme('DarkAmber') +sg.theme('DarkPurple5') header = ["name", "HV [V]", "Current [mA]"] @@ -26,6 +34,7 @@ mpod = iseg.Mpod(IP) if mpod.isConnected == False: exit() + chList = mpod.GetChList() hvList = mpod.GetAllHV() # get all V iList = mpod.GetAllCurrent() # get all current diff --git a/IsegLibrary.py b/IsegLibrary.py index b64a423..66e1ecd 100755 --- a/IsegLibrary.py +++ b/IsegLibrary.py @@ -18,6 +18,9 @@ class Mpod: except : print("cannot establish communitation via " + self.IP) + def SetIP(self, ip): + self.__init__(ip) + def SendCmd(self, option,cmd): if (self.isConnected == False ) : return 0 if option == 0 : diff --git a/README.md b/README.md index 3b3cdad..0b2accc 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ -request packages +# Request packages -sudo apt install python3-tk snmp snmp-mibs-downloader +in Ubuntu 20+ + +>sudo apt install python3-tk snmp snmp-mibs-downloader +>python3 -m pip install pysimplegui + +# Usage + +>python3 IsegHVController.py -python3 -m pip install pysimplegui