diff --git a/src/emagpy/__init__.py b/src/emagpy/__init__.py index 0c5dcaa..9f4875a 100644 --- a/src/emagpy/__init__.py +++ b/src/emagpy/__init__.py @@ -5,7 +5,7 @@ @author: jkl """ -EMagPy_version = '1.3.1' +EMagPy_version = '1.3.2' name = 'emagpy' from emagpy.Problem import Problem from emagpy.Survey import Survey diff --git a/src/ui-dir.spec b/src/ui-dir.spec index 2ec55ba..430bf74 100644 --- a/src/ui-dir.spec +++ b/src/ui-dir.spec @@ -71,7 +71,7 @@ exe = EXE(pyz, debug=False, strip=False, upx=True, - console=False, + console=False, # set to True for debugging icon='logo.ico') coll = COLLECT(exe, diff --git a/src/ui.py b/src/ui.py index e5fef0c..bdf47b4 100644 --- a/src/ui.py +++ b/src/ui.py @@ -58,6 +58,9 @@ pvfound = False print('WARNING: pyvista not found, 3D plotting will be disabled.') +# to automatically check version online +from urllib import request as urlRequest +import webbrowser # debug options DEBUG = True # set to false to not display message in the console @@ -223,6 +226,11 @@ class App(QMainWindow): ''' def __init__(self, parent=None): super().__init__() + + # check for new version + tupdate = customThread(self.updateChecker) + tupdate.signal.connect(self.updateCheckerShow) + tupdate.start() self.setWindowTitle('EMagPy v{:s}'.format(EMagPy_version)) self.setGeometry(100,100,1100,600) @@ -583,12 +591,12 @@ def gfCorrectionBtnFunc(): self.gfCorrectionBtn.setVisible(False) def showGF(arg): - visibles = np.array([True, True, False, False, False, False, False, False, False]) + visibles = [True, True, False, False, False, False, False, False, False] objs = [self.importBtn, self.mergedCheck, self.importGFLo, self.importGFHi, self.gfCalibCombo, self.gfCorrectionBtn, self.hxLabel, self.hxEdit, self.importGFApply] if arg is True: - [o.setVisible(v) for o,v in zip(objs, ~visibles)] + [o.setVisible(~v) for o,v in zip(objs, visibles)] else: [o.setVisible(v) for o,v in zip(objs, visibles)] showGF(False) @@ -1975,7 +1983,7 @@ def saveVtkBtnFunc():


- +

The depth of sensitivity of EMI measurements is dependent upon:

- - + +

@@ -2102,7 +2110,7 @@ def saveVtkBtnFunc(): unfeasible models.

- +

Inverse Settings

The starting model parameters can be supplied in the 'Inversion Settings' @@ -2110,7 +2118,7 @@ def saveVtkBtnFunc():

The user can also choose to fit an L-curve which will plot a graph of model and data misfit for a number of vertical smoothing values.

- +

Inversion

@@ -2388,33 +2396,33 @@ def keyPressEvent(self, e): #%% updater function and wine check # based on https://kushaldas.in/posts/pyqt5-thread-example.html -# def updateChecker(self): # check for new updates on gitlab -# version = ResIPy_version -# try: -# versionSource = urlRequest.urlopen('https://gitlab.com/hkex/pyr2/raw/master/src/version.txt?inline=false') -# versionCheck = versionSource.read().decode() -# version = versionCheck.split()[1] # assuming version number is in 2nd line of version.txt -# print('online version :', version) -# except: -# pass -# return version -# -# def updateCheckerShow(self, version): -# if ResIPy_version != version: -# msg = QMessageBox() -# msg.setIcon(QMessageBox.Information) -# msg.setText('''ResIPy version %s is available''' % (version)) -# msg.setInformativeText('''Please download the latest version of ResIPy at:

https://gitlab.com/hkex/pyr2


''') -# msg.setWindowTitle("New version available") -# bttnUpY = msg.addButton(QMessageBox.Yes) -# bttnUpY.setText('Update') -# bttnUpN = msg.addButton(QMessageBox.No) -# bttnUpN.setText('Ignore') -# msg.setDefaultButton(bttnUpY) -# msg.exec_() -# if msg.clickedButton() == bttnUpY: -# webbrowser.open('https://gitlab.com/hkex/pyr2#gui-for-r2-family-code') # can add download link, when we have a direct dl link -# + def updateChecker(self): # check for new updates on gitlab + version = EMagPy_version + try: + versionSource = urlRequest.urlopen('https://gitlab.com/hkex/emagpy/raw/master/src/version.txt?inline=false') + versionCheck = versionSource.read().decode() + version = versionCheck.split()[1] # assuming version number is in 2nd line of version.txt + print('online version :', version) + except: + pass + return version + + def updateCheckerShow(self, version): + if EMagPy_version != version: + msg = QMessageBox() + msg.setIcon(QMessageBox.Information) + msg.setText('''EMagPy version %s is available''' % (version)) + msg.setInformativeText('''Please download the latest version of EMagPy at:

https://gitlab.com/hkex/emagpy


''') + msg.setWindowTitle("New version available") + bttnUpY = msg.addButton(QMessageBox.Yes) + bttnUpY.setText('Update') + bttnUpN = msg.addButton(QMessageBox.No) + bttnUpN.setText('Ignore') + msg.setDefaultButton(bttnUpY) + msg.exec_() + if msg.clickedButton() == bttnUpY: + webbrowser.open('https://gitlab.com/hkex/emagpy#downloads') # can add download link, when we have a direct dl link + #%% main function