Example #1
0
    def __init__(self, parent=None, register=False):
        builder.GtkBuilder.__init__(self, "DetailsView.ui")
        gobject.GObject.__init__(self)
        if register:
            component.Component.__init__(self, "DetailsView")

        self.parent = parent or component.get("MainWindow")
        self.pedigree_mode = False
        self.pigeon = None
        self.child = None

        self.widgets.pigeonimage = PigeonImageWidget(False, self, parent)
        self.widgets.viewportImage.add(self.widgets.pigeonimage)
        self.widgets.pigeonimage_edit = PigeonImageWidget(True, self, parent)
        self.widgets.viewportImageEdit.add(self.widgets.pigeonimage_edit)

        self.widgets.combocolour.set_data(database.get_all_data(
            database.Tables.COLOURS),
                                          sort=False)
        self.widgets.combostrain.set_data(database.get_all_data(
            database.Tables.STRAINS),
                                          sort=False)
        self.widgets.comboloft.set_data(database.get_all_data(
            database.Tables.LOFTS),
                                        sort=False)

        self.widgets.combostatus.set_active(1)
        self.widgets.combostatus.emit("changed")

        self.widgets.statusdialog.set_transient_for(parent)
        self.widgets.root.show_all()
Example #2
0
 def _fill_racepoints_combo(self):
     data = database.get_all_data(database.Tables.RACEPOINTS)
     comboboxes.fill_combobox(self.widgets.combopoint, data)
     value = self.widgets.combopoint.get_active_text() is not None
     self.widgets.entrylatitude.set_sensitive(value)
     self.widgets.entrylongitude.set_sensitive(value)
     self.widgets.hboxdistance.set_sensitive(value)
     self.widgets.buttonsave.set_sensitive(value)
Example #3
0
 def on_buttonadd_clicked(self, widget):
     self._mode = enums.Action.add
     self._clear_dialog_widgets()
     self._fill_select_treeview()
     comboboxes.fill_combobox(self.widgets.comboloft,
                              database.get_all_data(database.Tables.LOFTS))
     self.widgets.dialog.show()
     self.widgets.entrydate2.grab_focus()
Example #4
0
    def __init__(self, treeview):
        builder.GtkBuilder.__init__(self, "FilterDialog.ui")
        self.treeview = treeview

        self.filter = utils.TreeviewFilter()

        self.widgets.combocolour.set_data(database.get_all_data(
            database.Tables.COLOURS),
                                          sort=False,
                                          active=None)
        self.widgets.combostrain.set_data(database.get_all_data(
            database.Tables.STRAINS),
                                          sort=False,
                                          active=None)
        self.widgets.comboloft.set_data(database.get_all_data(
            database.Tables.LOFTS),
                                        sort=False,
                                        active=None)
 def _fill_location_combos(self, racepoint):
     data = database.get_all_data(database.Tables.RACEPOINTS)
     data.insert(0, _("Custom"))
     data.insert(1, _("Loft"))
     activefrom = 1 if racepoint is not None else 0
     activeto = racepoint + 2 if racepoint is not None else 0
     comboboxes.fill_combobox(self.widgets.combolocationfrom, data,
                              activefrom, False)
     comboboxes.fill_combobox(self.widgets.combolocationto, data, activeto,
                              False)
Example #6
0
    def __init__(self):
        builder.GtkBuilder.__init__(self, "ResultsView.ui")
        basetab.BaseTab.__init__(self, "ResultsTab", _("Results"),
                                 "icon_result.png")

        self.pigeon = None

        view = get_view_for_current_config()
        self.widgets.resultview = view(self.widgets._root)
        self.widgets.resultview.set_columns()
        self.widgets.resultview.maintree.connect("button-press-event",
                                                 self.on_treeview_press)
        mainsel = self.widgets.resultview.maintree.get_selection()
        mainsel.connect("changed", self.on_selection_changed)

        self.widgets.comboracepoint.set_data(database.get_all_data(
            database.Tables.RACEPOINTS),
                                             sort=False)
        self.widgets.combosector.set_data(database.get_all_data(
            database.Tables.SECTORS),
                                          sort=False)
        self.widgets.combotype.set_data(database.get_all_data(
            database.Tables.TYPES),
                                        sort=False)
        self.widgets.combocategory.set_data(database.get_all_data(
            database.Tables.CATEGORIES),
                                            sort=False)
        self.widgets.comboweather.set_data(database.get_all_data(
            database.Tables.WEATHER),
                                           sort=False)
        self.widgets.combowind.set_data(database.get_all_data(
            database.Tables.WIND),
                                        sort=False)

        self.widgets.dialog.set_transient_for(self._parent)
Example #7
0
    def on_buttonedit_clicked(self, widget):
        self._mode = enums.Action.edit
        self._fill_select_treeview()
        comboboxes.fill_combobox(self.widgets.comboloft,
                                 database.get_all_data(database.Tables.LOFTS))
        med = database.get_medication_for_id(self._get_selected_medid())
        self.widgets.entrydate2.set_text(med["date"])
        self.widgets.entrydescription2.set_text(med["description"])
        self.widgets.entryby2.set_text(med["doneby"])
        self.widgets.entrymedication2.set_text(med["medication"])
        self.widgets.entrydosage2.set_text(med["dosage"])
        self.widgets.entrycomment2.set_text(med["comment"])
        self.widgets.checkvaccination2.set_active(med["vaccination"])
        for row in self.widgets.liststoreselect:
            if not row[0]: continue
            if row[2] in database.get_pigeons_for_medid(med["medid"]):
                row[1] = True

        self.widgets.dialog.show()
        self.widgets.entrydate2.grab_focus()
Example #8
0
    def __init__(self, parent):
        builder.GtkBuilder.__init__(self, "ResultWindow.ui")

        filename = "%s_%s" % (_("Results"), datetime.date.today())
        self.pdfname = filename + ".pdf"
        self.csvname = filename + ".csv"
        self._filter_races = utils.TreeviewFilter()
        self._filter_results = utils.TreeviewFilter()

        self._build_toolbar()

        view = get_view_for_current_config()
        self.widgets.resultview = view(self.widgets.hbox)
        self.widgets.resultview.set_columns()
        self.widgets.resultview.set_filter(self._filter_races,
                                           self._filter_results)
        self.widgets.resultview.fill_treeview()

        self.widgets.combopoint.set_data(database.get_all_data(
            database.Tables.RACEPOINTS),
                                         sort=False,
                                         active=None)
        self.widgets.combosector.set_data(database.get_all_data(
            database.Tables.SECTORS),
                                          sort=False,
                                          active=None)
        self.widgets.combotype.set_data(database.get_all_data(
            database.Tables.TYPES),
                                        sort=False,
                                        active=None)
        self.widgets.combocategory.set_data(database.get_all_data(
            database.Tables.CATEGORIES),
                                            sort=False,
                                            active=None)
        self.widgets.comboweather.set_data(database.get_all_data(
            database.Tables.WEATHER),
                                           sort=False,
                                           active=None)
        self.widgets.combowind.set_data(database.get_all_data(
            database.Tables.WIND),
                                        sort=False,
                                        active=None)

        self.widgets.resultwindow.set_transient_for(parent)
        self.widgets.resultwindow.show()