Ver código fonte

Further improvements to GUI

tags/1.6.1
Trevor Irons 5 anos atrás
pai
commit
3e71430955
5 arquivos alterados com 1652 adições e 1451 exclusões
  1. 89
    13
      akvo/gui/akvoGUI.py
  2. 1531
    1424
      akvo/gui/main.ui
  3. 29
    13
      akvo/gui/mydynamicmplcanvas.py
  4. 2
    0
      akvo/tressel/mrsurvey.py
  5. 1
    1
      setup.py

+ 89
- 13
akvo/gui/akvoGUI.py Ver arquivo

@@ -172,6 +172,25 @@ class ApplicationWindow(QtWidgets.QMainWindow):
172 172
         self.ui.plotGI.setEnabled(False) 
173 173
         self.ui.plotGI.pressed.connect( self.plotGI )
174 174
  
175
+        # hide header info box 
176
+        #self.ui.headerFileBox.setVisible(False) 
177
+        self.ui.headerFileBox.clicked.connect( self.headerBoxShrink ) 
178
+        self.ui.headerBox2.setVisible(False) 
179
+
180
+        # Clean up the tab widget 
181
+        self.ui.actionPreprocessing.triggered.connect(self.addPreProc)
182
+        self.ui.actionModelling.triggered.connect(self.addModelling)
183
+        self.ui.actionInversion.triggered.connect(self.addInversion)
184
+
185
+        # tabs 
186
+        #self.ui.ProcTabs.tabCloseRequested.connect( self.closeTabs )
187
+        #self.ui.ProcTabs.tabBar().setTabButton(7, QtWidgets.QTabBar.RightSide,None) 
188
+        self.ui.ProcTabs.removeTab(4)    
189
+        self.ui.ProcTabs.removeTab(4)    
190
+        self.ui.ProcTabs.removeTab(4)    
191
+        self.ui.ProcTabs.removeTab(4)    
192
+        #self.ui.LoadTab.close(  ) 
193
+
175 194
         # Add progressbar to statusbar
176 195
         self.ui.barProgress =  QtWidgets.QProgressBar()
177 196
         self.ui.statusbar.addPermanentWidget(self.ui.barProgress, 0);
@@ -181,6 +200,7 @@ class ApplicationWindow(QtWidgets.QMainWindow):
181 200
         self.ui.mplwidget_navigator.setCanvas(self.ui.mplwidget)
182 201
         #self.ui.mplwidget_navigator_2.setCanvas(self.ui.mplwidget)
183 202
 
203
+
184 204
         ##########################################################################
185 205
         # Loop Table 
186 206
         self.ui.loopTableWidget.setRowCount(80)       
@@ -231,6 +251,59 @@ class ApplicationWindow(QtWidgets.QMainWindow):
231 251
                 self.ui.layerTableWidget.setItem(ir, ic, pCell)
232 252
         self.ui.layerTableWidget.cellChanged.connect(self.sigmaCellChanged) 
233 253
 
254
+    def closeTabs(self):
255
+        #self.ui.ProcTabs.removeTab(idx)    
256
+        self.ui.ProcTabs.clear( )    
257
+    
258
+    def addPreProc(self):
259
+        if self.ui.actionPreprocessing.isChecked(): 
260
+            self.ui.actionModelling.setChecked(False) 
261
+            self.ui.actionInversion.setChecked(False) 
262
+            self.ui.ProcTabs.clear( )    
263
+            self.ui.ProcTabs.insertTab( 0, self.ui.LoadTab, "Load" )    
264
+            self.ui.ProcTabs.insertTab( 1, self.ui.NCTab, "NC" )    
265
+            self.ui.ProcTabs.insertTab( 2, self.ui.QCTab, "QC" )    
266
+            self.ui.ProcTabs.insertTab( 3, self.ui.METATab, "META" )    
267
+            self.ui.ProcTabs.insertTab( 4, self.ui.LogTab, "Log" )    
268
+        else:
269
+            self.ui.ProcTabs.removeTab(0)    
270
+            self.ui.ProcTabs.removeTab(0)    
271
+            self.ui.ProcTabs.removeTab(0)    
272
+            self.ui.ProcTabs.removeTab(0)    
273
+    
274
+    def addModelling(self):
275
+        if self.ui.actionModelling.isChecked(): 
276
+            self.ui.actionPreprocessing.setChecked(False) 
277
+            self.ui.actionInversion.setChecked(False) 
278
+            self.ui.ProcTabs.clear( )    
279
+            self.ui.ProcTabs.insertTab( 0, self.ui.KernTab, "Kernel" )    
280
+            self.ui.ProcTabs.insertTab( 1, self.ui.ModelTab, "Modelling" )    
281
+            self.ui.ProcTabs.insertTab( 2, self.ui.LogTab, "Log" )    
282
+        else:
283
+            self.ui.ProcTabs.removeTab(0)    
284
+            self.ui.ProcTabs.removeTab(0)    
285
+    
286
+    def addInversion(self, idx):
287
+        if self.ui.actionInversion.isChecked(): 
288
+            self.ui.actionPreprocessing.setChecked(False) 
289
+            self.ui.actionModelling.setChecked(False) 
290
+            self.ui.ProcTabs.clear( )    
291
+            self.ui.ProcTabs.insertTab( 0, self.ui.InvertTab, "Inversion" )    
292
+            self.ui.ProcTabs.insertTab( 1, self.ui.AppraiseTab, "Appraisal" )    
293
+            self.ui.ProcTabs.insertTab( 2, self.ui.LogTab, "Log" )    
294
+        else:
295
+            self.ui.ProcTabs.removeTab(0)    
296
+            self.ui.ProcTabs.removeTab(0)    
297
+
298
+    def headerBoxShrink(self):
299
+        #self.ui.headerFileBox.setVisible(False)
300
+ 
301
+        if self.ui.headerFileBox.isChecked( ): 
302
+            #self.ui.headerFileBox.setMinimumSize(460,250) 
303
+            self.ui.headerBox2.setVisible(True) 
304
+        else:
305
+            #self.ui.headerFileBox.setMinimumSize(460,50) 
306
+            self.ui.headerBox2.setVisible(False) 
234 307
 
235 308
     def sigmaCellChanged(self):
236 309
         self.ui.layerTableWidget.cellChanged.disconnect(self.sigmaCellChanged) 
@@ -365,18 +438,17 @@ class ApplicationWindow(QtWidgets.QMainWindow):
365 438
                 #pCell.setFlags( )
366 439
                 pCell.setBackground( QtGui.QColor("lightblue") )
367 440
 
368
-
369
-            
370
- 
371 441
         self.plotLoops()
372 442
         self.ui.loopTableWidget.cellChanged.connect(self.loopCellChanged) 
373 443
 
374 444
 
375 445
     def plotLoops(self):
376
-               
377
-        #self.ui.mplwidget_3.fig.clear() 
378
-        self.ui.mplwidget_3.ax1.clear() 
379
-        self.ui.mplwidget_3.ax2.clear()
446
+
447
+        print("Plotting loopz")        
448
+       
449
+        self.ui.mplwidget.reAxH(1)
450
+        #self.ui.mplwidget.ax1.clear() 
451
+        #self.ui.mplwidget.ax2.clear()
380 452
         nor = dict()
381 453
         eas = dict()
382 454
         dep = dict() 
@@ -403,12 +475,12 @@ class ApplicationWindow(QtWidgets.QMainWindow):
403 475
 
404 476
         for ii in nor.keys():            
405 477
             try:    
406
-                self.ui.mplwidget_3.ax1.plot(  np.array(nor[ii]), np.array(eas[ii])  )
478
+                self.ui.mplwidget.ax1.plot(  np.array(nor[ii]), np.array(eas[ii])  )
407 479
             except:
408 480
                 pass 
409
-        #self.ui.mplwidget_3.figure.axes().set
410
-        plt.gca().set_aspect('equal') #, adjustable='box')
411
-        self.ui.mplwidget_3.draw()
481
+        #self.ui.mplwidget.figure.axes().set
482
+        self.ui.mplwidget.ax1.set_aspect('equal') #, adjustable='box')
483
+        self.ui.mplwidget.draw()
412 484
 
413 485
     def about(self):
414 486
         # TODO proper popup with info
@@ -469,6 +541,8 @@ class ApplicationWindow(QtWidgets.QMainWindow):
469 541
         self.ui.lcdNumberNQ.setEnabled(True)
470 542
 
471 543
         self.ui.headerFileBox.setEnabled(True)
544
+        self.ui.headerFileBox.setChecked( True )
545
+        self.ui.headerBox2.setVisible(True) 
472 546
         self.ui.inputRAWParametersBox.setEnabled(True)
473 547
         self.ui.loadDataPushButton.setEnabled(True)
474 548
          
@@ -706,6 +780,8 @@ class ApplicationWindow(QtWidgets.QMainWindow):
706 780
         self.ui.lcdNumberNQ.setEnabled(True)
707 781
 
708 782
         self.ui.headerFileBox.setEnabled(True)
783
+        self.ui.headerFileBox.setChecked( False )
784
+        #self.ui.headerBox2.setVisible(True) 
709 785
         self.ui.inputRAWParametersBox.setEnabled(True)
710 786
         self.ui.loadDataPushButton.setEnabled(True)
711 787
         
@@ -1249,8 +1325,8 @@ def main():
1249 1325
     for ax in [ aw.ui.mplwidget ]: 
1250 1326
         ax.fig.clear()
1251 1327
         subplot = ax.fig.add_subplot(111)
1252
-        ax.fig.patch.set_facecolor( None )
1253
-        ax.fig.patch.set_alpha( .0 )
1328
+        #ax.fig.patch.set_facecolor( None )
1329
+        #ax.fig.patch.set_alpha( .0 )
1254 1330
         subplot.imshow(img) 
1255 1331
         subplot.xaxis.set_major_locator(plt.NullLocator()) 
1256 1332
         subplot.yaxis.set_major_locator(plt.NullLocator()) 

+ 1531
- 1424
akvo/gui/main.ui
Diferenças do arquivo suprimidas por serem muito extensas
Ver arquivo


+ 29
- 13
akvo/gui/mydynamicmplcanvas.py Ver arquivo

@@ -17,7 +17,8 @@ class MyMplCanvas(FigureCanvas):
17 17
     """Ultimately, this is a QWidget (as well as a FigureCanvasAgg, etc.)."""
18 18
     def __init__(self, parent=None, width=3, height=4, dpi=100):
19 19
         
20
-        self.fig = Figure(figsize=(width, height), dpi=dpi)
20
+        self.fig = Figure(figsize=(width, height), dpi=dpi, facecolor='darkgrey') # this fucking works...why?
21
+        #self.fig.patch.set_facecolor('blue')
21 22
         FigureCanvas.__init__(self, self.fig)
22 23
 
23 24
         self.setParent(parent)
@@ -33,35 +34,43 @@ class MyDynamicMplCanvas(MyMplCanvas):
33 34
 
34 35
     """A canvas that updates itself every second with a new plot."""
35 36
     def __init__(self, *args, **kwargs):
36
-        
37 37
         MyMplCanvas.__init__(self, *args, **kwargs)
38 38
         self.ax1 = self.fig.add_axes([.125,.1,.725,.8])
39 39
         self.ax2 = self.ax1.twinx() # fig.add_axes([.125,.1,.725,.8])
40 40
         self.compute_initial_figure()
41 41
 
42 42
     def reAxH(self, num, shx=True, shy=True):
43
+        
44
+        try:
45
+            for ax in fig.axes:
46
+                self.fig.delaxes(ax)
47
+        except:
48
+            pass
43 49
         try:
44 50
             self.fig.clear()
45 51
         except:
46 52
             pass
53
+
47 54
         for n in range(num):
48 55
             if n == 0:
49
-                self.ax1 = self.fig.add_subplot( 1, num, 1 )
56
+                self.ax1 = self.fig.add_subplot( 1, num, 1)
50 57
                 self.ax1.tick_params(axis='both', which='major', labelsize=8)
51 58
                 self.ax1.ticklabel_format(style='sci', scilimits=(0,0), axis='y')  
59
+                self.ax1.ticklabel_format(style='sci', scilimits=(0,0), axis='x')  
52 60
                 self.ax1.yaxis.get_offset_text().set_size(8) 
61
+                self.ax1.xaxis.get_offset_text().set_size(8) 
53 62
             if n == 1:
54
-                self.ax2 = self.fig.add_subplot( 1, num, 2 )
63
+                self.ax2 = self.fig.add_subplot( 1, num, 2)
55 64
                 self.ax2.tick_params(axis='both', which='major', labelsize=8)
56 65
                 self.ax2.ticklabel_format(style='sci', scilimits=(0,0), axis='y')  
57 66
                 self.ax2.yaxis.get_offset_text().set_size(8) 
58 67
             if n == 2:
59
-                self.ax3 = self.fig.add_subplot( 1, num, 3 )
68
+                self.ax3 = self.fig.add_subplot( 1, num, 3) 
60 69
                 self.ax3.tick_params(axis='both', which='major', labelsize=8)
61 70
                 self.ax3.ticklabel_format(style='sci', scilimits=(0,0), axis='y')  
62 71
                 self.ax3.yaxis.get_offset_text().set_size(8) 
63 72
             if n == 3:
64
-                self.ax4 = self.fig.add_subplot( 1, num, 4 )
73
+                self.ax4 = self.fig.add_subplot( 1, num, 4) 
65 74
                 self.ax4.tick_params(axis='both', which='major', labelsize=8)
66 75
                 self.ax4.ticklabel_format(style='sci', scilimits=(0,0), axis='y')  
67 76
                 self.ax4.yaxis.get_offset_text().set_size(8) 
@@ -72,7 +81,6 @@ class MyDynamicMplCanvas(MyMplCanvas):
72 81
                 self.fig.delaxes(ax)
73 82
         except:
74 83
             pass
75
-
76 84
         try:
77 85
             self.fig.clear()
78 86
         except:
@@ -80,29 +88,29 @@ class MyDynamicMplCanvas(MyMplCanvas):
80 88
         
81 89
         for n in range(num):
82 90
             if n == 0:
83
-                self.ax1 = self.fig.add_subplot( 2, num, 1 )
91
+                self.ax1 = self.fig.add_subplot( 2, num, 1)
84 92
                 self.ax1.tick_params(axis='both', which='major', labelsize=8)
85 93
                 self.ax1.ticklabel_format(style='sci', scilimits=(0,0), axis='y')  
86 94
                 self.ax1.yaxis.get_offset_text().set_size(8) 
87
-                self.ax21 = self.fig.add_subplot( 2, num, num+1 )
95
+                self.ax21 = self.fig.add_subplot( 2, num, num+1)
88 96
                 self.ax21.tick_params(axis='both', which='major', labelsize=8)
89 97
                 self.ax21.ticklabel_format(style='sci', scilimits=(0,0), axis='y')  
90 98
                 self.ax21.yaxis.get_offset_text().set_size(8) 
91 99
             if n == 1:
92
-                self.ax2 = self.fig.add_subplot( 2, num, 2, sharex=self.ax1, sharey=self.ax1 )
100
+                self.ax2 = self.fig.add_subplot( 2, num, 2, sharex=self.ax1, sharey=self.ax1)
93 101
                 self.ax2.tick_params(axis='both', which='major', labelsize=8)
94 102
                 self.ax2.ticklabel_format(style='sci', scilimits=(0,0), axis='y')  
95 103
                 self.ax2.yaxis.get_offset_text().set_size(8) 
96
-                self.ax22 = self.fig.add_subplot( 2, num, num+2, sharex=self.ax21, sharey=self.ax21 )
104
+                self.ax22 = self.fig.add_subplot( 2, num, num+2, sharex=self.ax21, sharey=self.ax21)
97 105
                 self.ax22.tick_params(axis='both', which='major', labelsize=8)
98 106
                 self.ax22.ticklabel_format(style='sci', scilimits=(0,0), axis='y')  
99 107
                 self.ax22.yaxis.get_offset_text().set_size(8) 
100 108
             if n == 2:
101
-                self.ax3 = self.fig.add_subplot( 2, num, 3, sharex=self.ax1, sharey=self.ax1 )
109
+                self.ax3 = self.fig.add_subplot( 2, num, 3, sharex=self.ax1, sharey=self.ax1)
102 110
                 self.ax3.tick_params(axis='both', which='major', labelsize=8)
103 111
                 self.ax3.ticklabel_format(style='sci', scilimits=(0,0), axis='y')  
104 112
                 self.ax3.yaxis.get_offset_text().set_size(8) 
105
-                self.ax23 = self.fig.add_subplot( 2, num, num+3, sharex=self.ax21, sharey=self.ax21 )
113
+                self.ax23 = self.fig.add_subplot( 2, num, num+3, sharex=self.ax21, sharey=self.ax21)
106 114
                 self.ax23.tick_params(axis='both', which='major', labelsize=8)
107 115
                 self.ax23.ticklabel_format(style='sci', scilimits=(0,0), axis='y')  
108 116
                 self.ax23.yaxis.get_offset_text().set_size(8) 
@@ -176,6 +184,7 @@ class MyDynamicMplCanvas(MyMplCanvas):
176 184
         except:
177 185
             pass
178 186
 
187
+        #self.fig.patch.set_facecolor('red')
179 188
         self.ax1 = self.fig.add_subplot(211)
180 189
         if shx and shy:
181 190
             self.ax2 = self.fig.add_subplot(212, sharex=self.ax1, sharey=self.ax1)
@@ -232,6 +241,13 @@ class MyDynamicMplCanvas(MyMplCanvas):
232 241
 
233 242
         self.ax3 = self.ax1.twinx()
234 243
 
244
+        #self.ax1.set_facecolor('red')
245
+        #self.ax2.set_facecolor('red')
246
+        #self.ax3.set_facecolor('red')
247
+        #self.fig.set_facecolor('red')
248
+        #self.fig.set_edgecolor('red')
249
+        #self.ax1.set_axis_bgcolor('green')
250
+
235 251
         self.ax1.tick_params(axis='both', which='major', labelsize=8)
236 252
         self.ax2.tick_params(axis='both', which='major', labelsize=8)
237 253
         self.ax3.tick_params(axis='both', which='major', labelsize=8)

+ 2
- 0
akvo/tressel/mrsurvey.py Ver arquivo

@@ -2216,6 +2216,7 @@ class GMRDataProcessor(SNMRDataProcessor):
2216 2216
         #    results = pool.starmap( loadGMRBinaryFID, zip(itertools.repeat(self), fnames, info ) ) # zip(np.tile(vc, (ns, 1)), np.tile(vgc, (ns,1)), itertools.repeat(sys.argv[1]), itertools.repeat(sys.argv[2]), EPS_CMR))
2217 2217
 
2218 2218
         # Plotting
2219
+
2219 2220
         if plot: 
2220 2221
             iistack = 0
2221 2222
             for istack in procStacks:
@@ -2223,6 +2224,7 @@ class GMRDataProcessor(SNMRDataProcessor):
2223 2224
                     canvas.ax1.clear()
2224 2225
                     canvas.ax2.clear()
2225 2226
                     canvas.ax3.clear()
2227
+                    #canvas.fig.patch.set_facecolor('blue')
2226 2228
                            
2227 2229
                     for ichan in chan:
2228 2230
                         canvas.ax1.plot(self.DATADICT["Pulse 1"]["PULSE_TIMES"], self.DATADICT["Pulse 1"]["CURRENT"][ipm][istack] , color='black')

+ 1
- 1
setup.py Ver arquivo

@@ -17,7 +17,7 @@ class custom_build_py(build_py):
17 17
         build_py.run(self)
18 18
 
19 19
 setup(name='Akvo',
20
-      version='1.0.6',
20
+      version='1.0.7',
21 21
       description='Surface nuclear magnetic resonance workbench',
22 22
       author='Trevor P. Irons',
23 23
       author_email='Trevor.Irons@lemmasoftware.org',

Carregando…
Cancelar
Salvar