Skip to content

Commit

Permalink
fix #125 config file
Browse files Browse the repository at this point in the history
  • Loading branch information
vinaynmcci committed Nov 29, 2023
1 parent 0414a79 commit 6ee526e
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 29 deletions.
1 change: 1 addition & 0 deletions src/configdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ def set_base_config_data(gdata):
cdata = read_all_config()
cdata["myrole"] = gdata["myrole"]
cdata["dut"]["nodes"] = gdata["dut"]["nodes"]
cdata["rpanel"] = gdata["rpanel"]
fpath = get_file_path()
save_config(fpath, cdata)

Expand Down
Empty file added src/features/modes/__init__.py
Empty file.
5 changes: 0 additions & 5 deletions src/panels/rightPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,6 @@ def update_my_panel(self, pdict):
self.slobj.append(dutLogWindow.DutLogWindow(self, self.parent, {pobj: dutdict[pobj]}))
self.display_my_objects()



def update_usb_tree_panel(self, duts):
print("Going to add Tree Panel : --->", duts["nodes"])

def add_switches(self, swlist):
self.Layout()

Expand Down
19 changes: 14 additions & 5 deletions src/uiMainApp.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ def __init__ (self, parent, title):

# Targetting for new release
self.usbenum = usbenumall.create_usb_device_enumerator()
if "msudp" not in self.config_data:
self.config_data["msudp"] = {"uname": None, "pwd": None}
mslogin = self.config_data["msudp"]
self.usbenum.set_login_credentials(mslogin["uname"], mslogin["pwd"])
# usb_device_enumerator.enumerate_usb_devices()

# Check for the latest version
Expand Down Expand Up @@ -494,9 +498,16 @@ def update_slog_menu(self):
if self.ucmenu.IsChecked() == True or self.ccmenu.IsChecked() == True:
# self.dutMenuBar.Check(ID_MENU_DUT1, self.duts["nodes"]["dut1"])
# self.dutMenuBar.Check(ID_MENU_DUT2, self.duts["nodes"]["dut2"])
self.dutMenuBar.Check(ID_MENU_DUT1, self.config_data["rpanel"]["dut1"])
self.dutMenuBar.Check(ID_MENU_DUT2, self.config_data["rpanel"]["dut2"])
self.toolMenu.Check(ID_USB4_TREEVIEW, self.config_data["rpanel"]["u4tree"])
if "rpanel" in self.config_data:
rpanel = self.config_data["rpanel"]
self.dutMenuBar.Check(ID_MENU_DUT1, rpanel["dut1"] if "dut1" in rpanel else False)
self.dutMenuBar.Check(ID_MENU_DUT2, rpanel["dut2"] if "dut2" in rpanel else False)
self.toolMenu.Check(ID_USB4_TREEVIEW, rpanel["u4tree"] if "u4tree" in rpanel else False)
else:
rpanel = {"dut1": False, "dut2": False, "u4tree": False}
self.config_data["rpanel"] = rpanel


else:
self.dutMenuBar.Enable(ID_MENU_DUT1, False)
self.dutMenuBar.Enable(ID_MENU_DUT2, False)
Expand Down Expand Up @@ -1658,7 +1669,6 @@ def enable_graph_menu(self):
"""
cdevices = list(self.swuidict.values())
print(cdevices)
if len(cdevices) > 0:
self.set_mode(MODE_MANUAL)
if '3142' in cdevices:
Expand Down Expand Up @@ -1860,7 +1870,6 @@ def saveMenus(self):
"""
findict = {"myrole": self.myrole, "dut": {"nodes": self.duts["nodes"]}, "rpanel": self.config_data["rpanel"]}
# findict = {"myrole": self.myrole, "dut": {"nodes": self.duts["nodes"]}}
configdata.set_base_config_data(findict)
self.saveScreenSize()

Expand Down
14 changes: 0 additions & 14 deletions src/uiPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,20 +165,6 @@ def update_right_panel(self, pdict):
"""
self.rpanel.update_my_panel(pdict)

def update_usb4_tree_panel(self, duts):
"""
Updates the USB4 tree panel with information about the specified DUTs.
Parameters:
duts (list): List of DUT (Device Under Test) information to be displayed in the USB4 tree panel.
Notes:
- Calls the `update_usb_tree_panel` method of the right panel (`rpanel`) to handle the update.
- Performs a layout update after the USB4 tree panel is updated.
"""
self.rpanel.update_usb_tree_panel(duts)
self.Layout()

def update_usb4_tree(self, msusb4):
"""
Updates the USB4 tree with information from the provided USB4 data.
Expand Down
1 change: 0 additions & 1 deletion src/usb4tree/winusb4parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def __init__(self):
self.ldata = None

def parse_usb4tb_data(self, usb4data):
print("Win USB4 Tree Parsing not implemented!")
self.idata = None
self.ldata = None
self.idata = self.get_item_data(usb4data)
Expand Down
3 changes: 3 additions & 0 deletions src/usbenum/linuxusbenum.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ def __init__(self):
self.pwd = "mcci"
self.usb4tb_json = None
self.usb4tb_list = []

def set_login_credentials(self, uname, pwd):
pass

def enumerate_usb_devices(self):
"""
Expand Down
3 changes: 3 additions & 0 deletions src/usbenum/macusbenum.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ def __init__(self):
self.usb4tb_json = None
self.usb4tb_dict = {}

def set_login_credentials(self, uname, pwd):
pass

def enumerate_usb_devices(self):
"""
Enumerate both USB 3.0 and USB4 and USB4TB devices.
Expand Down
14 changes: 10 additions & 4 deletions src/usbenum/winusbenum.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,23 @@ def __init__(self):
self.ws = None
self.connected = False
self.completed = False
self.uname = "mcci"
self.pwd = "mcci"
self.uname = None
self.pwd = None
self.usb4tb_json = None
self.usb4tb_list = []

def set_login_credentials(self, uname, pwd):
self.uname = uname
self.pwd = pwd

def enumerate_usb_devices(self):
# raise NotImplementedError("Subclasses must implement enumerate_usb_devices")
self.completed = False
self.enumerate_usb3_devices()
self.enumerate_usb4tb_devices()
if self.uname != None and self.pwd != None:
self.enumerate_usb4tb_devices()
else:
self.completed = True


def enumerate_usb4tb_devices(self):
Expand Down Expand Up @@ -165,7 +172,6 @@ def on_usb4tb_error(self, ws, error):
self.completed = True

def on_usb4tb_close(self, ws, scode, msg):
print(f"Win USB4 Enumeration closed with status {scode}: {msg}")
self.completed = True


Expand Down

0 comments on commit 6ee526e

Please sign in to comment.