Ejemplo n.º 1
0
 def quitClicked(self):
     if self.updated:
         updates = {}
         lines = []
         for i in range(2):
             lines.append(self.dir_labels[i].lower() + '_files=' + \
                          self.dirs[i].text().replace(getUser(), '$USER$'))
         updates['Files'] = lines
         SaveIni(updates, ini_file=self.config_file)
     self.close()
Ejemplo n.º 2
0
 def closeEvent(self, event):
     if self.restorewindows:
         updates = {}
         lines = []
         add = int((self.frameSize().width() - self.size().width()) /
                   2)  # need to account for border
         lines.append(
             'flexiplot_pos=%s,%s' %
             (str(self.pos().x() + add), str(self.pos().y() + add)))
         lines.append('flexiplot_size=%s,%s' %
                      (str(self.width()), str(self.height())))
         updates['Windows'] = lines
         SaveIni(updates, ini_file=self.config_file)
     event.accept()
Ejemplo n.º 3
0
 def saveClicked(self):
     updates = {}
     colour_lines = []
     for key in self.colours:
         colour_lines.append('%s_high=%s' % (key, self.colours[key][2]))
         colour_lines.append('%s_low=%s' % (key, self.colours[key][1]))
     updates['Colors' + self.map] = colour_lines
     view_lines = []
     view_lines.append('resource_opacity=%s' % str(self.opacitySpin.value()))
     view_lines.append('resource_period=$YEAR$%s' % self.periodCombo.currentText()[4:])
     view_lines.append('resource_steps=%s' % str(self.stepSpin.value()))
     view_lines.append('resource_variable=%s' % self.whatCombo.currentText())
     updates['View'] = view_lines
     SaveIni(updates)
Ejemplo n.º 4
0
 def saveClicked(self):
     updates = {}
     lines = [[], []]
     for key, value in self.colours.items():
         for i in range(2):
             if value[i] == 'delete':
                 lines[i].append(key + '=')
             elif value[i] != '':
                 lines[i].append(key + '=' + value[i].name())
             elif self.section != 'Colors':
                 lines[i].append(key + '=')
     if len(lines[0]) > 0:
         updates[self.section + self.map] = lines[0]
     updates[self.section] = lines[1]
     SaveIni(updates, ini_file=self.config_file)
     self.close()
Ejemplo n.º 5
0
 def closeEvent(self, event):
  #   self.clear_Resource()
     if self.restorewindows:
         updates = {}
         lines = []
         add = int((self.frameSize().width() - self.size().width()) / 2)   # need to account for border
         lines.append('resource_pos=%s,%s' % (str(self.pos().x() + add), str(self.pos().y() + add)))
         lines.append('resource_size=%s,%s' % (str(self.width()), str(self.height())))
         updates['Windows'] = lines
         SaveIni(updates)
     if self.do_loop:
         self.scene.exitLoop = True
     if self.be_open:
         self.procStart.emit('goodbye')
     self.hideClicked()
     event.accept()
Ejemplo n.º 6
0
 def closeEvent(self, event):
     if self.restorewindows:
         updates = {}
         lines = []
         add = int((self.frameSize().width() - self.size().width()) /
                   2)  # need to account for border
         lines.append(
             'legend_pos=%s,%s' %
             (str(self.pos().x() + add), str(self.pos().y() + add)))
         lines.append('legend_size=%s,%s' %
                      (str(self.width()), str(self.height())))
         updates['Windows'] = lines
         SaveIni(updates)
     if self.be_open:
         self.procStart.emit('goodbye')
     event.accept()
Ejemplo n.º 7
0
 def closeEvent(self, event):
     if self.restorewindows:
         updates = {}
         lines = []
         add = int((self.frameSize().width() - self.size().width()) /
                   2)  # need to account for border
         lines.append(
             'menu_pos=%s,%s' %
             (str(self.pos().x() + add), str(self.pos().y() + add)))
         lines.append('menu_size=%s,%s' %
                      (str(self.width()), str(self.height())))
         open_menus = ''
         for key in list(self.topmenus.keys()):
             if self.topmenus[key][0]:
                 open_menus += ',' + key
         if open_menus != '':
             lines.append('menu_open=%s' % open_menus[1:])
         updates['Windows'] = lines
         SaveIni(updates)
     if self.be_open:
         self.procStart.emit('goodbye')
     event.accept()
Ejemplo n.º 8
0
 def closeEvent(self, event):
     if self.logged:
         reply = QtWidgets.QMessageBox.question(
             self, self.program + ' Status',
             'Do you want to save Session log?',
             QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No,
             QtWidgets.QMessageBox.No)
         if reply == QtWidgets.QMessageBox.Yes:
             self.save()
     if self.restorewindows:
         updates = {}
         lines = []
         add = int((self.frameSize().width() - self.size().width()) /
                   2)  # need to account for border
         lines.append(
             'log_pos=%s,%s' %
             (str(self.pos().x() + add), str(self.pos().y() + add)))
         lines.append('log_size=%s,%s' %
                      (str(self.width()), str(self.height())))
         updates['Windows'] = lines
         SaveIni(updates)
     if self.be_open:
         self.procStart.emit('goodbye')
     event.accept()
Ejemplo n.º 9
0
 def saveConfig(self):
     updates = {}
     if self.updated:
         config = configparser.RawConfigParser()
         config.read(self.config_file)
         try:
             choice = self.history[0]
         except:
             choice = ''
         save_file = self.file.text().replace(getUser(), '$USER$')
         try:
             self.max_files = int(config.get('Flexiplot', 'file_choices'))
         except:
             pass
         lines = []
         fix_history = []
         try:
             if len(self.history) > 0:
                 check_history = []
                 line = ''
                 for i in range(len(self.history)):
                     itm = self.history[i]
                     if self.files.itemText(i) in check_history:
                         fix_history.append([i, itm])
                     else:
                         check_history.append(self.files.itemText(i))
                         line += itm + ','
                 line = line[:-1]
                 lines.append('file_history=' + line)
         except:
             pass
         cols = 'columns' + choice + '='
         for col in range(self.order.count()):
             try:
                 if self.order.item(col).text().index(',') >= 0:
                     try:
                         if self.order.item(col).text().index("'") >= 0:
                             qte = '"'
                     except:
                         qte = "'"
             except:
                 qte = ''
             cols += qte + self.order.item(col).text() + qte + ','
         if cols[-1] != '=':
             cols = cols[:-1]
         lines.append(cols)
         lines.append('file' + choice + '=' +
                      self.file.text().replace(getUser(), '$USER$'))
         lines.append('grid' + choice + '=' + self.gridtype.currentText())
         lines.append('maximum' + choice + '=')
         if self.maxSpin.value() != 0:
             lines[-1] = lines[-1] + str(self.maxSpin.value())
         lines.append('percentage' + choice + '=')
         if self.percentage.isChecked():
             lines[-1] = lines[-1] + 'True'
         lines.append('plot' + choice + '=' + self.plottype.currentText())
         lines.append('sheet' + choice + '=' + self.sheet.currentText())
         line = 'series' + choice + '='
         for series in self.series:
             if series.find(',') >= 0:
                 line += "'" + series + "',"
             else:
                 line += series + ','
         lines.append(line[:-1])
         lines.append('title' + choice + '=' + self.title.text())
         lines.append('xlabel' + choice + '=' + self.xlabel.text())
         line = 'xvalues' + choice + '='
         for xvalues in self.xvalues:
             if xvalues.find(',') >= 0:
                 line += "'" + xvalues + "',"
             else:
                 line += xvalues + ','
         lines.append(line[:-1])
         lines.append('ylabel' + choice + '=' + self.ylabel.text())
         props = [
             'columns', 'file', 'grid', 'maximum', 'percentage', 'plot',
             'sheet', 'series', 'title', 'xlabel', 'xvalues', 'ylabel'
         ]
         for i in range(len(fix_history) - 1, -1, -1):
             self.files.removeItem(fix_history[i][0])
             self.history.pop(fix_history[i][0])
             for prop in props:
                 lines.append(prop + fix_history[i][1] + '=')
         updates['Flexiplot'] = lines
         if self.restorewindows and not config.has_section(
                 'Windows'):  # new file set windows section
             updates['Windows'] = ['restorewindows=True']
     if self.colours_updated:
         lines = []
         for key, value in self.colours.items():
             if value != '':
                 lines.append(key.replace(' ', '_') + '=' + value)
         updates['Plot Colors'] = lines
     SaveIni(updates, ini_file=self.config_file)
     self.updated = False
     self.colours_updated = False