def editFilterEvent(self): filt = OrbsFilter( all_orbs_filters_names()[self.filtersBox.currentIndex()]) edit = OrbsFilterDialog(self, filt) ok = edit.exec_() if ok: self.reset()
def editFilterEvent(self): filt = OrbsFilter( all_orbs_filters_names()[self.filtersBox.currentIndex()]) edit = OrbsFilterDialog(self, filt) ok = edit.exec_() if ok: self.reset()
def __init__(self, parent=None): QDialog.__init__(self, parent) self._parent = parent tr = self.tr self.setWindowTitle(tr('Orbs Filters Manager')) self.setSizeGripEnabled(True) # layout grid = QGridLayout(self) self.setLayout(grid) # list of filters self.filtersBox = QComboBox(self) self.filtersBox.setEditable(False) self.filtersBox.addItems(all_orbs_filters_names()) grid.addWidget(self.filtersBox, 0, 0) # buttons buttonsLayout = QHBoxLayout() grid.addLayout(buttonsLayout, 1, 0) newButton = QPushButton(tr('New'), self) self.connect(newButton, SIGNAL('clicked()'), self.newFilterEvent) buttonsLayout.addWidget(newButton) editButton = QPushButton(tr('Edit'), self) self.connect(editButton, SIGNAL('clicked()'), self.editFilterEvent) buttonsLayout.addWidget(editButton) deleteButton = QPushButton(tr('Delete'), self) self.connect(deleteButton, SIGNAL('clicked()'), self.deleteFilterEvent) buttonsLayout.addWidget(deleteButton) closeButton = QPushButton(tr('Close'), self) closeButton.setDefault(True) self.connect(closeButton, SIGNAL('clicked()'), SLOT('close()')) buttonsLayout.addWidget(closeButton)
def resetOrbsFilters(self): """Reset orbs filters box.""" self.orbsEdit.clear() all = all_orbs_filters_names() self.orbsEdit.addItems(all) i = all.index(self._filt._orbs._name) self.orbsEdit.setCurrentIndex(i)
def __init__(self, parent=None): QDialog.__init__(self, parent) self._parent = parent tr = self.tr self.setWindowTitle(tr('Orbs Filters Manager')) self.setSizeGripEnabled(True) # layout grid = QGridLayout(self) self.setLayout(grid) # list of filters self.filtersBox = QComboBox(self) self.filtersBox.setEditable(False) self.filtersBox.addItems(all_orbs_filters_names()) grid.addWidget(self.filtersBox, 0, 0) # buttons buttonsLayout = QHBoxLayout() grid.addLayout(buttonsLayout, 1, 0) newButton = QPushButton(tr('New'), self) self.connect(newButton, SIGNAL('clicked()'), self.newFilterEvent) buttonsLayout.addWidget(newButton) editButton = QPushButton(tr('Edit'), self) self.connect(editButton, SIGNAL('clicked()'), self.editFilterEvent) buttonsLayout.addWidget(editButton) deleteButton = QPushButton(tr('Delete'), self) self.connect(deleteButton, SIGNAL('clicked()'), self.deleteFilterEvent) buttonsLayout.addWidget(deleteButton) closeButton = QPushButton(tr('Close'), self) closeButton.setDefault(True) self.connect(closeButton, SIGNAL('clicked()'), SLOT('close()')) buttonsLayout.addWidget(closeButton)
def resetOrbsFilters(self): """Reset orbs filters box.""" self.orbsEdit.clear() all = all_orbs_filters_names() self.orbsEdit.addItems(all) i = all.index(self._filt._orbs._name) self.orbsEdit.setCurrentIndex(i)
def editOrbsFilter(self): of = OrbsFilter(all_orbs_filters_names()[self.orbsEdit.currentIndex()]) edit = OrbsFilterDialog(self, of) ok = edit.exec_() if ok: ## reset our filters if of == self._filt._orbs: self._filt._orbs.reset() self.resetOrbsFilters()
def editOrbsFilter(self): of = OrbsFilter( all_orbs_filters_names()[self.orbsEdit.currentIndex()]) edit = OrbsFilterDialog(self, of) ok = edit.exec_() if ok: ## reset our filters if of == self._filt._orbs: self._filt._orbs.reset() self.resetOrbsFilters()
def accept(self): """Set filter new values and save.""" tr = self.tr # name name = unicode(self.nameEdit.text()) if name == '': QMessageBox.critical(self, tr('Missing Name'), tr('Please set filter name.')) self.nameEdit.setFocus() return # planets filter planets = PlanetsFilter( all_planets_filters_names()[self.planetsEdit.currentIndex()]) # aspects filter aspects = AspectsFilter( all_aspects_filters_names()[self.aspectsEdit.currentIndex()]) # orbs filter orbs = OrbsFilter( all_orbs_filters_names()[self.orbsEdit.currentIndex()]) # aspects restrictions asprestr = AspectsRestrictions( all_aspects_restrictions_names()[self.asprestrEdit.currentIndex()]) # orbs restrictions orbrestr = OrbsRestrictions( all_orbs_restrictions_names()[self.orbrestrEdit.currentIndex()]) # comment cmt = unicode(self.commentEdit.toPlainText()) # ### set filter ### self._filt.set(name=name, planets=planets, aspects=aspects, orbs=orbs, asprestr=asprestr, orbrestr=orbrestr, comment=cmt) # save try: self._filt.save() except ValueError: # duplicate filter QMessageBox.critical( self, tr('Error'), unicode(tr('Duplicate filter name \xab %(filter)s \xbb.')) % {'filter': self._filt._name}) self.nameEdit.setFocus() return # reload cfg in case filter is default, # and opened charts if using this filter if __name__ != '__main__': app.midPointsFilterUpdatedEvent(self._filt._idx_) # done self.done(QDialog.Accepted)
def deleteFilterEvent(self): tr = self.tr name = all_orbs_filters_names()[self.filtersBox.currentIndex()] ret = QMessageBox.warning(self, tr('Delete Orbs Filter'), unicode(tr('Are you sure you want to delete orbs filter \xab %(filter)s \xbb ?')) % { 'filter': name}, QMessageBox.Cancel|QMessageBox.Yes, QMessageBox.Yes) if ret == QMessageBox.Yes: filt = OrbsFilter(name) try: filt.delete() except ValueError: # cannot delete default filter QMessageBox.critical(self, tr('Required Orbs Filter'), tr('Cannot delete required filter.')) self.reset()
def deleteFilterEvent(self): tr = self.tr name = all_orbs_filters_names()[self.filtersBox.currentIndex()] ret = QMessageBox.warning( self, tr('Delete Orbs Filter'), unicode( tr('Are you sure you want to delete orbs filter \xab %(filter)s \xbb ?' )) % {'filter': name}, QMessageBox.Cancel | QMessageBox.Yes, QMessageBox.Yes) if ret == QMessageBox.Yes: filt = OrbsFilter(name) try: filt.delete() except ValueError: # cannot delete default filter QMessageBox.critical(self, tr('Required Orbs Filter'), tr('Cannot delete required filter.')) self.reset()
def accept(self): """Set filter new values and save.""" tr = self.tr # name name = unicode(self.nameEdit.text()) if name == '': QMessageBox.critical(self, tr('Missing Name'), tr('Please set filter name.')) self.nameEdit.setFocus() return # planets filter planets = PlanetsFilter( all_planets_filters_names()[self.planetsEdit.currentIndex()]) # aspects filter aspects = AspectsFilter( all_aspects_filters_names()[self.aspectsEdit.currentIndex()]) # orbs filter orbs = OrbsFilter( all_orbs_filters_names()[self.orbsEdit.currentIndex()]) # aspects restrictions asprestr = AspectsRestrictions( all_aspects_restrictions_names()[self.asprestrEdit.currentIndex()]) # orbs restrictions orbrestr = OrbsRestrictions( all_orbs_restrictions_names()[self.orbrestrEdit.currentIndex()]) # comment cmt = unicode(self.commentEdit.toPlainText()) # ### set filter ### self._filt.set(name=name, planets=planets, aspects=aspects, orbs=orbs, asprestr=asprestr, orbrestr=orbrestr, comment=cmt) # save try: self._filt.save() except ValueError: # duplicate filter QMessageBox.critical(self, tr('Error'), unicode(tr('Duplicate filter name \xab %(filter)s \xbb.')) % { 'filter': self._filt._name}) self.nameEdit.setFocus() return # reload cfg in case filter is default, # and opened charts if using this filter if __name__ != '__main__': app.midPointsFilterUpdatedEvent(self._filt._idx_) # done self.done(QDialog.Accepted)
def reset(self): """Reload filters list.""" self.filtersBox.clear() self.filtersBox.addItems(all_orbs_filters_names())
def accept(self): """Set filter new values and save.""" tr = self.tr # name name = unicode(self.nameEdit.text()) if name == '': QMessageBox.critical(self, tr('Missing Name'), tr('Please set filter name.')) self.nameEdit.setFocus() return # bg color bg = self.bgcolorEdit.currentIndex() if bg == 0: bg = 'black' else: bg = 'white' # ephe type ephetype = self.ephetypeEdit.currentIndex() if ephetype == 0: ephetype = 'swiss' elif ephetype == 1: ephetype = 'jpl' else: ephetype = 'moshier' # ephe path ephepath = unicode(self.ephepathEdit.text()) # hsys hsys = names.houseSystems[self.hsysEdit.currentIndex()][0] # sidereal mode sidm = names.sidModes[self.sidmodeEdit.currentIndex()][0] # sidereal t0 sidt0 = self.sidt0Edit.value() # sidereal ayanamsa t0 sidayant0 = self.sidayant0Edit.value() # true pos truepos = False if self.trueposEdit.currentIndex() == 0 else True # xcentric xcentric = self.xcentricEdit.currentIndex() if xcentric == 0: xcentric = 'geo' elif xcentric == 1: xcentric = 'topo' elif xcentric == 2: xcentric = 'helio' else: xcentric = 'bary' # planets filter planets = all_planets_filters_names()[self.planetsEdit.currentIndex()] # aspects filter aspects = all_aspects_filters_names()[self.aspectsEdit.currentIndex()] # orbs filter orbs = all_orbs_filters_names()[self.orbsEdit.currentIndex()] # aspects restrictions asprestr = all_aspects_restrictions_names()[self.asprestrEdit.currentIndex()] # orbs restrictions orbrestr = all_orbs_restrictions_names()[self.orbrestrEdit.currentIndex()] # midpoints settings calc_midp = self.calc_midpEdit.isChecked() draw_midp = self.draw_midpEdit.isChecked() # midpoints filter midpoints = all_midpoints_filters_names()[self.midpointsEdit.currentIndex()] # comment cmt = unicode(self.commentEdit.toPlainText()) # ### set filter ### self._filt.set(name=name, bg_color=bg, ephe_type=ephetype, ephe_path=ephepath, hsys=hsys, sid_mode=sidm, sid_t0=sidt0, sid_ayan_t0=sidayant0, true_pos=truepos, xcentric=xcentric, calc_midp=calc_midp, draw_midp=draw_midp, planets=planets, aspects=aspects, orbs=orbs, asprestr=asprestr, orbrestr=orbrestr, midpoints=midpoints, comment=cmt) # save try: self._filt.save() except ValueError: # duplicate filter QMessageBox.critical(self, tr('Error'), unicode(tr('Duplicate filter name \xab %(filter)s \xbb.')) % { 'filter': self._filt._name}) self.nameEdit.setFocus() return # reload cfg in case filter is default, # and opened charts if using this filter if __name__ != '__main__': app.filterUpdatedEvent(self._filt._idx_) # done self.done(QDialog.Accepted)
def reset(self): """Reload filters list.""" self.filtersBox.clear() self.filtersBox.addItems(all_orbs_filters_names())
def accept(self): """Set filter new values and save.""" tr = self.tr # name name = unicode(self.nameEdit.text()) if name == '': QMessageBox.critical(self, tr('Missing Name'), tr('Please set filter name.')) self.nameEdit.setFocus() return # bg color bg = self.bgcolorEdit.currentIndex() if bg == 0: bg = 'black' else: bg = 'white' # ephe type ephetype = self.ephetypeEdit.currentIndex() if ephetype == 0: ephetype = 'swiss' elif ephetype == 1: ephetype = 'jpl' else: ephetype = 'moshier' # ephe path ephepath = unicode(self.ephepathEdit.text()) # hsys hsys = names.houseSystems[self.hsysEdit.currentIndex()][0] # sidereal mode sidm = names.sidModes[self.sidmodeEdit.currentIndex()][0] # sidereal t0 sidt0 = self.sidt0Edit.value() # sidereal ayanamsa t0 sidayant0 = self.sidayant0Edit.value() # true pos truepos = False if self.trueposEdit.currentIndex() == 0 else True # xcentric xcentric = self.xcentricEdit.currentIndex() if xcentric == 0: xcentric = 'geo' elif xcentric == 1: xcentric = 'topo' elif xcentric == 2: xcentric = 'helio' else: xcentric = 'bary' # planets filter planets = all_planets_filters_names()[self.planetsEdit.currentIndex()] # aspects filter aspects = all_aspects_filters_names()[self.aspectsEdit.currentIndex()] # orbs filter orbs = all_orbs_filters_names()[self.orbsEdit.currentIndex()] # aspects restrictions asprestr = all_aspects_restrictions_names()[ self.asprestrEdit.currentIndex()] # orbs restrictions orbrestr = all_orbs_restrictions_names()[ self.orbrestrEdit.currentIndex()] # midpoints settings calc_midp = self.calc_midpEdit.isChecked() draw_midp = self.draw_midpEdit.isChecked() # midpoints filter midpoints = all_midpoints_filters_names()[ self.midpointsEdit.currentIndex()] # comment cmt = unicode(self.commentEdit.toPlainText()) # ### set filter ### self._filt.set(name=name, bg_color=bg, ephe_type=ephetype, ephe_path=ephepath, hsys=hsys, sid_mode=sidm, sid_t0=sidt0, sid_ayan_t0=sidayant0, true_pos=truepos, xcentric=xcentric, calc_midp=calc_midp, draw_midp=draw_midp, planets=planets, aspects=aspects, orbs=orbs, asprestr=asprestr, orbrestr=orbrestr, midpoints=midpoints, comment=cmt) # save try: self._filt.save() except ValueError: # duplicate filter QMessageBox.critical( self, tr('Error'), unicode(tr('Duplicate filter name \xab %(filter)s \xbb.')) % {'filter': self._filt._name}) self.nameEdit.setFocus() return # reload cfg in case filter is default, # and opened charts if using this filter if __name__ != '__main__': app.filterUpdatedEvent(self._filt._idx_) # done self.done(QDialog.Accepted)