From c13e7b0f873e4857f1ce7924c0a72609df3ddca2 Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Fri, 24 Jul 2020 01:08:02 +0530 Subject: platform independent library and image paths, flake8 compliant --- src/kicadtoNgspice/SubcircuitTab.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/kicadtoNgspice/SubcircuitTab.py') diff --git a/src/kicadtoNgspice/SubcircuitTab.py b/src/kicadtoNgspice/SubcircuitTab.py index d68cb97e..f4b759c5 100644 --- a/src/kicadtoNgspice/SubcircuitTab.py +++ b/src/kicadtoNgspice/SubcircuitTab.py @@ -146,10 +146,14 @@ class SubcircuitTab(QtGui.QWidget): # print "Object Called is ",sending_btn.objectName() self.widgetObjCount = int(sending_btn.objectName()) + init_path = '../../' + if os.name == 'nt': + init_path = '' + self.subfile = str( QtGui.QFileDialog.getExistingDirectory( self, "Open Subcircuit", - "library/SubcircuitLibrary") + init_path + "library/SubcircuitLibrary") ) self.reply = self.obj_validation.validateSub( self.subfile, self.numPorts[self.widgetObjCount - 1]) -- cgit From 2eb6697de529a643127599070771a0278e9817b3 Mon Sep 17 00:00:00 2001 From: rahulp13 Date: Mon, 3 Aug 2020 12:03:41 +0530 Subject: ported GUI to PyQt5 --- src/kicadtoNgspice/SubcircuitTab.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/kicadtoNgspice/SubcircuitTab.py') diff --git a/src/kicadtoNgspice/SubcircuitTab.py b/src/kicadtoNgspice/SubcircuitTab.py index f4b759c5..4c7179d3 100644 --- a/src/kicadtoNgspice/SubcircuitTab.py +++ b/src/kicadtoNgspice/SubcircuitTab.py @@ -1,11 +1,11 @@ -from PyQt4 import QtGui +from PyQt5 import QtWidgets from . import TrackWidget from projManagement import Validation import os from xml.etree import ElementTree as ET -class SubcircuitTab(QtGui.QWidget): +class SubcircuitTab(QtWidgets.QWidget): """ - This class creates Subcircuit Tab in KicadtoNgspice Window - It dynamically creates the widget for subcircuits, @@ -37,7 +37,7 @@ class SubcircuitTab(QtGui.QWidget): except BaseException: print("Subcircuit Previous values XML is Empty") - QtGui.QWidget.__init__(self) + QtWidgets.QWidget.__init__(self) # Creating track widget object self.obj_trac = TrackWidget.TrackWidget() @@ -57,7 +57,7 @@ class SubcircuitTab(QtGui.QWidget): self.numPorts = [] # Set Layout - self.grid = QtGui.QGridLayout() + self.grid = QtWidgets.QGridLayout() self.setLayout(self.grid) for eachline in schematicInfo: @@ -66,10 +66,10 @@ class SubcircuitTab(QtGui.QWidget): # print("Subcircuit : Words", words[0]) self.obj_trac.subcircuitList[project_name + words[0]] = words self.subcircuit_dict_beg[words[0]] = self.count - subbox = QtGui.QGroupBox() - subgrid = QtGui.QGridLayout() + subbox = QtWidgets.QGroupBox() + subgrid = QtWidgets.QGridLayout() subbox.setTitle("Add subcircuit for " + words[len(words) - 1]) - self.entry_var[self.count] = QtGui.QLineEdit() + self.entry_var[self.count] = QtWidgets.QLineEdit() self.entry_var[self.count].setText("") global path_name @@ -94,7 +94,7 @@ class SubcircuitTab(QtGui.QWidget): print("Error before subcircuit :", str(e)) subgrid.addWidget(self.entry_var[self.count], self.row, 1) - self.addbtn = QtGui.QPushButton("Add") + self.addbtn = QtWidgets.QPushButton("Add") self.addbtn.setObjectName("%d" % self.count) # Send the number of ports specified with the given\ # subcircuit for verification. @@ -151,7 +151,7 @@ class SubcircuitTab(QtGui.QWidget): init_path = '' self.subfile = str( - QtGui.QFileDialog.getExistingDirectory( + QtWidgets.QFileDialog.getExistingDirectory( self, "Open Subcircuit", init_path + "library/SubcircuitLibrary") ) @@ -166,14 +166,14 @@ class SubcircuitTab(QtGui.QWidget): self.obj_trac.subcircuitTrack[self.subName] = self.subfile elif self.reply == "PORT": - self.msg = QtGui.QErrorMessage(self) + self.msg = QtWidgets.QErrorMessage(self) self.msg.setModal(True) self.msg.setWindowTitle("Error Message") self.msg.showMessage( "Please select a Subcircuit with correct number of ports.") self.msg.exec_() elif self.reply == "DIREC": - self.msg = QtGui.QErrorMessage(self) + self.msg = QtWidgets.QErrorMessage(self) self.msg.setModal(True) self.msg.setWindowTitle("Error Message") self.msg.showMessage( @@ -201,14 +201,14 @@ class SubcircuitTab(QtGui.QWidget): # Storing to track it during conversion self.obj_trac.subcircuitTrack[self.subName] = self.subfile elif self.reply == "PORT": - self.msg = QtGui.QErrorMessage(self) + self.msg = QtWidgets.QErrorMessage(self) self.msg.setModal(True) self.msg.setWindowTitle("Error Message") self.msg.showMessage( "Please select a Subcircuit with correct number of ports.") self.msg.exec_() elif self.reply == "DIREC": - self.msg = QtGui.QErrorMessage(self) + self.msg = QtWidgets.QErrorMessage(self) self.msg.setModal(True) self.msg.setWindowTitle("Error Message") self.msg.showMessage( -- cgit