def tab_activate(self): """ Runs when the tab is activated """ self.lmod1 = self.parent.lmod1 misc.update_lith_lw(self.lmod1, self.lw_param_defs) # Need this to init the first values. self.lw_index_change() self.dsb_gregional.setValue(self.lmod1.gregional)
def tab_activate(self): """ Runs when the tab is activated """ self.lmod1 = self.parent.lmod1 self.mmc.lmod = self.lmod1 self.xnodes = self.lmod1.custprofx self.ynodes = self.lmod1.custprofy self.pcntmax = len(self.xnodes)-1 misc.update_lith_lw(self.lmod1, self.lw_prof_defs) self.hslider_profile2.valueChanged.disconnect() self.combo_profpic.currentIndexChanged.disconnect() self.sb_profnum2.valueChanged.disconnect() self.hslider_profile2.setMinimum(0) self.hslider_profile2.setMaximum(self.pcntmax) self.sb_profnum2.setMaximum(self.pcntmax) if len(self.lmod1.profpics) > 0: self.combo_profpic.clear() self.combo_profpic.addItems(list(self.lmod1.profpics.keys())) self.combo_profpic.setCurrentIndex(0) self.change_model() # needs to happen before profnum set value self.sb_profnum2.setValue(self.curprof) self.update_plot() self.sb_profnum2.valueChanged.connect(self.sprofnum) self.hslider_profile2.valueChanged.connect(self.hprofnum) self.combo_profpic.currentIndexChanged.connect(self.profpic_hs)
def merge_defs(self): """ Merge geophysical definitions Returns ------- None. """ mlith = MergeLith() for i in self.lmod1.lith_list: mlith.lw_lithmaster.addItem(i) mlith.lw_lithmerge.addItem(i) tmp = mlith.exec_() if tmp == 0: return lithmaster = mlith.lw_lithmaster.selectedItems() lithmerge = mlith.lw_lithmerge.selectedItems() index_master = self.lmod1.lith_list[lithmaster[0].text()].lith_index for i in lithmerge: mtxt = i.text() j = self.lmod1.lith_list[mtxt].lith_index self.lmod1.lith_index[self.lmod1.lith_index == j] = index_master if mtxt != 'Background': del self.lmod1.lith_list[mtxt] misc.update_lith_lw(self.lmod1, self.lw_param_defs)
def rem_defs(self): """ Remove geophysical definition. Returns ------- None. """ crow = self.lw_param_defs.currentRow() if crow == -1: return ctxt = str(self.lw_param_defs.currentItem().text()) if ctxt == 'Background': self.showtext('You cannot delete the background lithology') return if self.lw_param_defs.count() <= 2: self.showtext('You must have at least two lithologies') return lind = self.lmod1.lith_list[ctxt].lith_index del self.lmod1.lith_list[ctxt] self.lmod1.lith_index[self.lmod1.lith_index == lind] = 0 self.lw_param_defs.takeItem(crow) misc.update_lith_lw(self.lmod1, self.lw_param_defs)
def tab_activate(self): """ Entry point. Returns ------- None. """ self.lmod1 = self.parent.lmod1 misc.update_lith_lw(self.lmod1, self.lw_param_defs) # Need this to init the first values. itxt = str(self.lw_param_defs.item(0).text()) lith = self.lmod1.lith_list[itxt] self.dsb_ght.setValue(-lith.zobsg) self.dsb_hint.setValue(lith.hintn) self.dsb_hinc.setValue(lith.finc) self.dsb_hdec.setValue(lith.fdec) self.dsb_mht.setValue(-lith.zobsm) self.lw_index_change() self.dsb_gregional.setValue(self.lmod1.gregional) self.exec_() self.parent.profile.lw_prof_defs.setCurrentRow(-1) self.parent.profile.change_defs()
def tab_activate(self): """ Runs when the tab is activated """ self.lmod1 = self.parent.lmod1 self.mmc.lmod = self.lmod1 self.xnodes = self.lmod1.custprofx self.ynodes = self.lmod1.custprofy self.pcntmax = len(self.xnodes) - 1 misc.update_lith_lw(self.lmod1, self.lw_prof_defs) self.hslider_profile2.valueChanged.disconnect() self.combo_profpic.currentIndexChanged.disconnect() self.sb_profnum2.valueChanged.disconnect() self.hslider_profile2.setMinimum(0) self.hslider_profile2.setMaximum(self.pcntmax) self.sb_profnum2.setMaximum(self.pcntmax) if len(self.lmod1.profpics) > 0: self.combo_profpic.clear() self.combo_profpic.addItems(list(self.lmod1.profpics.keys())) self.combo_profpic.setCurrentIndex(0) self.change_model() # needs to happen before profnum set value self.sb_profnum2.setValue(self.curprof) self.update_plot() self.sb_profnum2.valueChanged.connect(self.sprofnum) self.hslider_profile2.valueChanged.connect(self.hprofnum) self.combo_profpic.currentIndexChanged.connect(self.profpic_hs)
def merge_defs(self): """ Remove geophysical definitions """ mlith = MergeLith() for i in self.lmod1.lith_list: mlith.lw_lithmaster.addItem(i) mlith.lw_lithmerge.addItem(i) tmp = mlith.exec_() if tmp == 0: return lithmaster = mlith.lw_lithmaster.selectedItems() lithmerge = mlith.lw_lithmerge.selectedItems() index_master = self.lmod1.lith_list[lithmaster[0].text()].lith_index for i in lithmerge: mtxt = i.text() j = self.lmod1.lith_list[mtxt].lith_index self.lmod1.lith_index[self.lmod1.lith_index == j] = index_master if mtxt != 'Background': del self.lmod1.lith_list[mtxt] misc.update_lith_lw(self.lmod1, self.lw_param_defs)
def tab_activate(self): """ Runs when the tab is activated """ self.lmod = self.parent.lmod1 self.mmc.set_limits(self.lmod) self.mmc.lmod = self.lmod self.update_combos() misc.update_lith_lw(self.lmod, self.lw_editor_defs) self.sb_model_layer.setMaximum(self.lmod.numz-1) self.combo()
def tab_activate(self): """ Runs when the tab is activated """ self.lmod = self.parent.lmod1 self.mmc.set_limits(self.lmod) self.mmc.lmod = self.lmod self.update_combos() misc.update_lith_lw(self.lmod, self.lw_editor_defs) self.sb_model_layer.setMaximum(self.lmod.numz - 1) self.combo()
def tab_activate(self): """ Runs when the tab is activated """ self.lmod1 = self.parent.lmod1 misc.update_lith_lw(self.lmod1, self.lw_param_defs) # Need this to init the first values. self.codelist = {} self.noteslist = {} for i in self.lmod1.lith_list: self.codelist[i] = self.lmod1.lith_list[i].lithcode self.noteslist[i] = self.lmod1.lith_list[i].lithnotes self.exec_()
def change_defs(self): """ List box in layer tab for definitions """ i = self.lw_editor_defs.currentRow() if i == -1: misc.update_lith_lw(self.lmod, self.lw_editor_defs) i = 0 itxt = str(self.lw_editor_defs.item(i).text()) if itxt not in self.lmod.lith_list: return lith = self.lmod.lith_list[itxt] self.mmc.curmodel = lith.lith_index
def add_defs(self, deftxt='', getcol=False, lmod=None): """ Add geophysical definitions and make them editable""" if lmod is not None: self.islmod1 = False else: lmod = self.lmod1 self.islmod1 = True if not lmod.lith_list: self.max_lith_index = -1 else: lmod.update_lith_list_reverse() self.max_lith_index = max(lmod.lith_list_reverse.keys()) defnum = self.lw_param_defs.count() if deftxt == '': deftxt = 'Generic ' + str(defnum) lmod.lith_list[deftxt] = grvmag3d.GeoData(self.parent, lmod.numx, lmod.numy, lmod.numz, lmod.dxy, lmod.d_z, lmod.mht, lmod.ght) litho = lmod.lith_list['Background'] lithn = lmod.lith_list[deftxt] lithn.hintn = litho.hintn lithn.finc = litho.finc lithn.fdec = litho.fdec lithn.zobsm = litho.zobsm lithn.bdensity = litho.bdensity lithn.zobsg = litho.zobsg self.max_lith_index += 1 lithn.lith_index = self.max_lith_index if deftxt == 'Background': lithn.susc = 0 lithn.density = lithn.bdensity if getcol is True: col = QtWidgets.QColorDialog.getColor() lmod.mlut[lithn.lith_index] = [col.red(), col.green(), col.blue()] # setup list widgets misc.update_lith_lw(self.lmod1, self.lw_param_defs) if defnum == 0: lithn.susc = 0 lithn.density = lithn.bdensity self.lw_index_change()
def add_defs(self, deftxt='', getcol=False, lmod=None): """ Add geophysical definitions and make them editable""" if lmod is not None: self.islmod1 = False else: lmod = self.lmod1 self.islmod1 = True if not lmod.lith_list: self.max_lith_index = -1 else: lmod.update_lith_list_reverse() self.max_lith_index = max(lmod.lith_list_reverse.keys()) defnum = self.lw_param_defs.count() if deftxt == '': deftxt = 'Generic '+str(defnum) lmod.lith_list[deftxt] = grvmag3d.GeoData( self.parent, lmod.numx, lmod.numy, lmod.numz, lmod.dxy, lmod.d_z, lmod.mht, lmod.ght) litho = lmod.lith_list['Background'] lithn = lmod.lith_list[deftxt] lithn.hintn = litho.hintn lithn.finc = litho.finc lithn.fdec = litho.fdec lithn.zobsm = litho.zobsm lithn.bdensity = litho.bdensity lithn.zobsg = litho.zobsg self.max_lith_index += 1 lithn.lith_index = self.max_lith_index if deftxt == 'Background': lithn.susc = 0 lithn.density = lithn.bdensity if getcol is True: col = QtWidgets.QColorDialog.getColor() lmod.mlut[lithn.lith_index] = [col.red(), col.green(), col.blue()] # setup list widgets misc.update_lith_lw(self.lmod1, self.lw_param_defs) if defnum == 0: lithn.susc = 0 lithn.density = lithn.bdensity self.lw_index_change()
def tab_activate(self): """ Entry point. Returns ------- None. """ self.lmod1 = self.parent.lmod1 misc.update_lith_lw(self.lmod1, self.lw_param_defs) # Need this to init the first values. self.codelist = {} self.noteslist = {} for i in self.lmod1.lith_list: self.codelist[i] = self.lmod1.lith_list[i].lithcode self.noteslist[i] = self.lmod1.lith_list[i].lithnotes self.exec_()
def rem_defs(self): """ Remove geophysical definitions """ crow = self.lw_param_defs.currentRow() if crow == -1: return ctxt = str(self.lw_param_defs.currentItem().text()) if ctxt == 'Background': self.showtext('You cannot delete the background lithology') return if self.lw_param_defs.count() <= 2: self.showtext('You must have at least two lithologies') return lind = self.lmod1.lith_list[ctxt].lith_index del self.lmod1.lith_list[ctxt] self.lmod1.lith_index[self.lmod1.lith_index == lind] = 0 self.lw_param_defs.takeItem(crow) misc.update_lith_lw(self.lmod1, self.lw_param_defs)
def tab_activate(self): """ Runs when the tab is activated """ self.lmod1 = self.parent.lmod1 self.mmc.lmod = self.lmod1 txtmsg = ('Note: The display of gravity or magnetic data is ' 'triggered off their respective calculations. Press ' '"Calculate Gravity" to see the gravity plot and ' '"Calculate Magnetics" to see the magnetic plot') if txtmsg not in self.parent.txtmsg.split('\n'): self.showtext(txtmsg) misc.update_lith_lw(self.lmod1, self.lw_prof_defs) self.hs_profnum.valueChanged.disconnect() self.combo_profpic.currentIndexChanged.disconnect() self.sb_profnum.valueChanged.disconnect() self.hs_profnum.setMinimum(0) if self.lmod1.is_ew: self.hs_profnum.setMaximum(self.lmod1.numy - 1) else: self.hs_profnum.setMaximum(self.lmod1.numx - 1) if self.lmod1.profpics: self.combo_profpic.clear() self.combo_profpic.addItems(list(self.lmod1.profpics.keys())) self.combo_profpic.setCurrentIndex(0) self.change_model() # needs to happen before profnum set value self.sb_profnum.setValue(self.lmod1.curprof) self.hs_profnum.setValue(self.sb_profnum.value()) self.update_plot() self.sb_profnum.valueChanged.connect(self.sprofnum) self.hs_profnum.valueChanged.connect(self.hprofnum) self.combo_profpic.currentIndexChanged.connect(self.profpic_hs)
def tab_activate(self): """ Runs when the tab is activated """ self.lmod1 = self.parent.lmod1 self.mmc.lmod = self.lmod1 txtmsg = ('Note: The display of gravity or magnetic data is ' 'triggered off their respective calculations. Press ' '"Calculate Gravity" to see the gravity plot and ' '"Calculate Magnetics" to see the magnetic plot') if txtmsg not in self.parent.txtmsg.split('\n'): self.showtext(txtmsg) misc.update_lith_lw(self.lmod1, self.lw_prof_defs) self.hs_profnum.valueChanged.disconnect() self.combo_profpic.currentIndexChanged.disconnect() self.sb_profnum.valueChanged.disconnect() self.hs_profnum.setMinimum(0) if self.lmod1.is_ew: self.hs_profnum.setMaximum(self.lmod1.numy-1) else: self.hs_profnum.setMaximum(self.lmod1.numx-1) if self.lmod1.profpics: self.combo_profpic.clear() self.combo_profpic.addItems(list(self.lmod1.profpics.keys())) self.combo_profpic.setCurrentIndex(0) self.change_model() # needs to happen before profnum set value self.sb_profnum.setValue(self.lmod1.curprof) self.hs_profnum.setValue(self.sb_profnum.value()) self.update_plot() self.sb_profnum.valueChanged.connect(self.sprofnum) self.hs_profnum.valueChanged.connect(self.hprofnum) self.combo_profpic.currentIndexChanged.connect(self.profpic_hs)
def add_defs(self, deftxt='', getcol=False, lmod=None): """ Add geophysical definitions and make them editable. Parameters ---------- deftxt : str, optional Definition text. The default is ''. getcol : bool, optional Get column. The default is False. lmod : LithModel, optional 3D model. The default is None. Returns ------- None. """ if lmod is not None: self.islmod1 = False else: lmod = self.lmod1 self.islmod1 = True new_lith_index = 0 if lmod.lith_list: lmod.update_lith_list_reverse() new_lith_index = max(lmod.lith_list_reverse.keys())+1 defnum = self.lw_param_defs.count() if deftxt == '': deftxt = 'Generic '+str(defnum) lmod.lith_list[deftxt] = grvmag3d.GeoData( self.parent, lmod.numx, lmod.numy, lmod.numz, lmod.dxy, lmod.d_z, lmod.mht, lmod.ght) litho = lmod.lith_list['Background'] lithn = lmod.lith_list[deftxt] lithn.hintn = litho.hintn lithn.finc = litho.finc lithn.fdec = litho.fdec lithn.zobsm = litho.zobsm lithn.bdensity = litho.bdensity lithn.zobsg = litho.zobsg lithn.lith_index = new_lith_index if deftxt == 'Background': lithn.susc = 0 lithn.density = lithn.bdensity if getcol is True: col = QtWidgets.QColorDialog.getColor(parent=self.parent) lmod.mlut[lithn.lith_index] = [col.red(), col.green(), col.blue()] # setup list widgets misc.update_lith_lw(self.lmod1, self.lw_param_defs) if defnum == 0: lithn.susc = 0 lithn.density = lithn.bdensity self.lw_index_change()