Beispiel #1
0
 def execute(self):
     file_name = get_open_file_name(_('Open SportOrg json'), _('SportOrg (*.json)'))
     if file_name is not '':
         with open(file_name) as f:
             attr = get_races_from_file(f)
         SportOrgImportDialog(*attr).exec_()
         self.app.refresh()
Beispiel #2
0
 def execute(self):
     file_name = get_open_file_name(_('Open IOF xml'), _('IOF xml (*.xml)'))
     if file_name is not '':
         try:
             iof_xml.import_from_iof(file_name)
         except Exception as e:
             logging.exception(str(e))
             QMessageBox.warning(self.app, _('Error'), _('Import error') + ': ' + file_name)
         self.app.init_model()
Beispiel #3
0
 def execute(self):
     file_name = get_open_file_name(_('Open Ocad txt v8 file'), _("Ocad classes v8 (*.txt)"))
     if file_name is not '':
         try:
             ocad.import_txt_v8(file_name)
         except OcadImportException as e:
             logging.error(str(e))
             QMessageBox.warning(self.app, _('Error'), _('Import error') + ': ' + file_name)
         self.app.init_model()
Beispiel #4
0
 def execute(self):
     file_name = get_open_file_name(_('Open CSV Winorient file'), _("CSV Winorient (*.csv)"))
     if file_name is not '':
         try:
             winorient.import_csv(file_name)
         except Exception as e:
             logging.error(str(e))
             QMessageBox.warning(self.app, _('Error'), _('Import error') + ': ' + file_name)
         self.app.init_model()
Beispiel #5
0
 def execute(self):
     file_name = get_open_file_name(_('Open WDB Winorient file'), _("WDB Winorient (*.wdb)"))
     if file_name is not '':
         try:
             winorient.import_wo_wdb(file_name)
         except WDBImportError as e:
             logging.error(str(e))
             logging.exception(e)
             QMessageBox.warning(self.app, _('Error'), _('Import error') + ': ' + file_name)
         self.app.init_model()
Beispiel #6
0
 def select_custom_path():
     file_name = get_open_file_name(_('Open HTML template'), _("HTML file (*.html)"))
     self.item_template.setCurrentText(file_name)
Beispiel #7
0
from sportorg.language import _
from sportorg.libs.winorient.wdb import WDB, write_wdb


def set_numbers(wdb_target, wdb_source):
    """
    :type wdb_target: WDB
    :type wdb_source: WDB
    """
    changed = False
    for i in wdb_target.man:
        name = i.name
        source = wdb_source.find_man_by_name(name)
        if source and source.qualification:
            i.qualification = source.qualification
            changed = True
    return changed


if __name__ == '__main__':

    app = QApplication(sys.argv)
    file1 = get_open_file_name(_('Open target WDB file'), _("WDB file (*.wdb)"))
    file2 = get_open_file_name(_('Open source WDB file'), _("WDB file (*.wdb)"))
    wb1 = WinOrientBinary(file1).wdb_object
    wb2 = WinOrientBinary(file2).wdb_object

    if set_numbers(wb1, wb2):
        file3 = get_save_file_name(_('Save WDB file'), _("WDB file (*.wdb)"))
        write_wdb(wb1, file3)
Beispiel #8
0
 def execute(self):
     file_name = get_open_file_name(_('Open SportOrg file'),
                                    _("SportOrg file (*.json)"))
     self.app.open_file(file_name)