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/subcircuit/uploadSub.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/subcircuit/uploadSub.py') diff --git a/src/subcircuit/uploadSub.py b/src/subcircuit/uploadSub.py index 25a6e7d4..c7b3951f 100644 --- a/src/subcircuit/uploadSub.py +++ b/src/subcircuit/uploadSub.py @@ -63,8 +63,12 @@ class UploadSub(QtGui.QWidget): print("Invalid file format") return + init_path = '../../' + if os.name == 'nt': + init_path = '' + subcircuit_path = os.path.join( - os.path.abspath('library'), + os.path.abspath(init_path + 'library'), 'SubcircuitLibrary', create_subcircuit ) -- 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/subcircuit/uploadSub.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/subcircuit/uploadSub.py') diff --git a/src/subcircuit/uploadSub.py b/src/subcircuit/uploadSub.py index c7b3951f..13924bf3 100644 --- a/src/subcircuit/uploadSub.py +++ b/src/subcircuit/uploadSub.py @@ -1,11 +1,11 @@ -from PyQt4 import QtGui +from PyQt5 import QtWidgets from configuration.Appconfig import Appconfig from projManagement.Validation import Validation import os import shutil -class UploadSub(QtGui.QWidget): +class UploadSub(QtWidgets.QWidget): """ This class contain function for uploading subcircuits in SubcircuitLibrary present in src folder. @@ -30,8 +30,9 @@ class UploadSub(QtGui.QWidget): true if file has valid format or else it shows an error message. """ - editfile = QtGui.QFileDialog.getOpenFileName( - None, "Upload Subcircuit File", os.path.expanduser("~"), "*.sub") + editfile = QtWidgets.QFileDialog.getOpenFileName( + None, "Upload Subcircuit File", os.path.expanduser("~"), "*.sub" + )[0] if editfile == '': return @@ -40,7 +41,7 @@ class UploadSub(QtGui.QWidget): create_subcircuit, ext = os.path.splitext(upload) if ext != '.sub': - self.msg = QtGui.QErrorMessage(self) + self.msg = QtWidgets.QErrorMessage(self) self.msg.setModal(True) self.msg.setWindowTitle("Error Message") self.msg.showMessage("Please ensure that filename ends with .sub") @@ -50,7 +51,7 @@ class UploadSub(QtGui.QWidget): valid = self.obj_validation.validateSubcir(editfile, create_subcircuit) if not valid: - self.msg = QtGui.QErrorMessage(self) + self.msg = QtWidgets.QErrorMessage(self) self.msg.setModal(True) self.msg.setWindowTitle("Error Message") self.msg.showMessage( @@ -89,7 +90,7 @@ class UploadSub(QtGui.QWidget): elif reply == "CHECKEXIST": print("Project name already exists.") print("==========================") - msg = QtGui.QErrorMessage(self) + msg = QtWidgets.QErrorMessage(self) msg.setModal(True) msg.setWindowTitle("Error Message") msg.showMessage( @@ -100,7 +101,7 @@ class UploadSub(QtGui.QWidget): elif reply == "CHECKNAME": print("Name can not contain space between them") print("===========================") - msg = QtGui.QErrorMessage(self) + msg = QtWidgets.QErrorMessage(self) msg.setModal(True) msg.setWindowTitle("Error Message") msg.showMessage( -- cgit