From 03d9b4aa619eb756533ba967b75537abe2eca457 Mon Sep 17 00:00:00 2001 From: G4IXT Date: Wed, 28 Feb 2024 22:10:07 +0000 Subject: [PATCH] v0.10.1 bugfix Fixed error in database preventing writing of rows Fixed indexing error in import of own export file Fixed Windows database path including my name --- QtTSAprefs.db | Bin 131072 -> 131072 bytes QtTinySA.py | 25 ++++++++++--------------- 2 files changed, 10 insertions(+), 15 deletions(-) mode change 100644 => 100755 QtTinySA.py diff --git a/QtTSAprefs.db b/QtTSAprefs.db index 3692b66bc755d04851ae3af82dc4b9cffbdd698a..19de68362a0bd34200d33523cdb69f749b40f3b2 100644 GIT binary patch delta 3462 zcmc(ie{56N702Iu*naQXe*O`1$0c#W0h)#tTE|HsEkE*X$4)$Ar-@&FG)uG0t^;Y~ z@FQhy2;{}3teWIH{8qNmNKOEY~c*v7E6Su{>sZz;cgegT-YL%m`+R|axbLEW|oeJ$?9j-3MoM)lB-&%^b`=<-Qj z;%?&wNtgM^;7HP)9CnW+lEX=(aB37E?v}W6Vk`Uo0e7R%FRDYe``&JvDaGlf61SWe zIZ*4b3B>$@IyZ5n>Z6wrBb+W_(6(R)LD$G?fSe2pMI!`#aA?JucBJF9gJC_9AYt!; z!(K46Gbk1a5cJ2H(tU3OvN5Q&nR>iB02d&IL6PPjVs(kA2V`XsRj=nV*V{fgv=W$w zVJ*Rspyo0~9cC8Y13Ge<-=6_9u#y=>)#ox7$<_c#42lJ)!wbDtAH4!dEFvAkNag1; zG&8_VMFxn<&t+a%h=-9uRQ|DwqIv^^T7oe_Jyuavzl1^l7)8G&-mZp&OnK{2A8Sg76qae9V#za_V*Y^?L%@DfRF>x;Vz1Pnnyo(`J+?WWy+O8qIlOaBxgl2g1V)3PtZF1Z+s1rx?=F47EIFBK=?t;UR`}k#NWDPo_<4-a`06hEQ>F`_R_| zPo@!mV3Fuh<0N!(yI>8U?L&BQ5&3Ik!A>ByU(DXs?Lc@3Lukh1w(-Bex#}Xq+ZobH z#KjfpA60)tcz_`h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0B}wun_|p43@TK>+<+soNa$LMia#usV8?FktYUp*wU9q6e9Tm$fG-XlHE;@!B ze)}S7QWj@&7Zfp_53aGbRN5+I^@T@Hh}Ravr^GcV>Xj?&>%|`=3p-AUN99C19_fsQ q3ja7I8ij?Qi|Y%gpA_o~y+yI2@JTlzn2`jiv^ diff --git a/QtTinySA.py b/QtTinySA.py old mode 100644 new mode 100755 index 5e5c0ee..abdac37 --- a/QtTinySA.py +++ b/QtTinySA.py @@ -44,9 +44,6 @@ os.environ['XDG_CONFIG_DIRS'] = '/etc:/usr/local/etc' os.environ['XDG_DATA_DIRS'] = '/usr/share:/usr/local/share' -# appauthor is only relevant for Windows and will be ignored on OSX and Linux. -appauthor = "Ian Jefferson" - logging.basicConfig(format="%(message)s", level=logging.INFO) threadpool = QtCore.QThreadPool() basedir = os.path.dirname(__file__) @@ -736,9 +733,8 @@ class database(): def __init__(self): self.db = None self.dbName = "QtTSAprefs.db" - self.personalDir = platformdirs.user_config_dir(appname=app.applicationName(), - appauthor=appauthor, ensure_exists=True) - self.globalDir = platformdirs.site_config_dir(appname=app.applicationName(), appauthor=appauthor) + self.personalDir = platformdirs.user_config_dir(appname=app.applicationName(), ensure_exists=True) + self.globalDir = platformdirs.site_config_dir(appname=app.applicationName()) self.workingDir = os.getcwd() self.dbpath = self._getPersonalisedPath() @@ -825,15 +821,12 @@ def insertData(self, name, typeF, startF, stopF, colour): record.setValue('name', name) record.setValue('startF', f'{startF:.6f}') record.setValue('stopF', f'{stopF:.6f}') - bandstype.tm.setFilter('preset = "' + typeF + '"') # using relation directly doesn't seem to work bandstype.tm.select() record.setValue('preset', bandstype.tm.record(0).value('ID')) - colours.tm.setFilter('colour = "' + colour + '"') # using relation directly doesn't seem to work colours.tm.select() record.setValue('colour', colours.tm.record(0).value('ID')) - self.tm.insertRecord(-1, record) self.tm.select() self.tm.layoutChanged.emit() @@ -860,13 +853,14 @@ def readCSV(self, fileName): for row in csv.reader(fileInput): if not header: header = row + logging.debug(f'header = {header}') indx = self.findCols(header) continue - if len(indx) == 7: # (name, preset, typeF, startF, stopF, value, colour) - bands.insertData(row[indx[0]], row[indx[2]], float(row[indx[3]]), float(row[indx[4]]), row[indx[6]]) + if len(indx) == 6: # (name, preset(=type), startF, stopF, value(=visible), colour) + bands.insertData(row[indx[0]], row[indx[1]], float(row[indx[2]]), float(row[indx[3]]), row[indx[5]]) elif len(indx) == 3: bands.insertData(row[indx[0]], 'RF mic', float(row[indx[1]]) / 1e3, 0, row[indx[2]].lower()) - logging.info(f'colour = {row[indx[2]].lower()}') + logging.debug(f'colour = {row[indx[2]].lower()}') def writeCSV(self, fileName): header = [] @@ -883,8 +877,9 @@ def writeCSV(self, fileName): def findCols(self, header): indx = [] try: - for i in range(1, self.tm.columnCount()): + for i in range(1, self.tm.columnCount()): # start at 1 - don't include ID column indx.append(header.index(self.tm.record().fieldName(i))) # Match to QtTinySA CSV export format + logging.debug(f'i = {i} indx = {indx}') except ValueError: indx = [] try: @@ -1008,7 +1003,7 @@ def dialogPrefs(): def about(): - message = ('TinySA Ultra GUI programme using Qt5 and PyQt\nAuthor: Ian Jefferson G4IXT\n\nVersion: {} \nDatabase Path: {}' + message = ('TinySA Ultra GUI programme using Qt5 and PyQt\nAuthor: Ian Jefferson G4IXT\n\nVersion: {} \nConfig: {}' .format(app.applicationVersion(), config.dbpath)) popUp(message, QMessageBox.Ok, QMessageBox.Information) @@ -1087,7 +1082,7 @@ def importData(): app = QtWidgets.QApplication([]) # create QApplication for the GUI app.setApplicationName('QtTinySA') -app.setApplicationVersion(' v0.10.0') +app.setApplicationVersion(' v0.10.1') window = QtWidgets.QMainWindow() ui = QtTinySpectrum.Ui_MainWindow() ui.setupUi(window)