Work on native gui. Display records and add missing tasks and measurements.
This commit is contained in:
+25
-1
@@ -11,6 +11,7 @@ class ProjectsView(View):
|
||||
|
||||
def __init__(self, context):
|
||||
super().__init__(context, _("Projects"), "projects.ui")
|
||||
self.context = context
|
||||
|
||||
self.project = project.Project(context.db) # current record
|
||||
self.newrecord = False
|
||||
@@ -42,6 +43,9 @@ class ProjectsView(View):
|
||||
treeview.add_column(self.tree['projects'], _('Remarks'), 5)
|
||||
self.tree['projects'].set_model(self.lst_projects)
|
||||
|
||||
self.dd_user = context.lookup.user()
|
||||
self.dd_state = self.context.lookup.enum('project.projstate')
|
||||
|
||||
# buttons on list page
|
||||
def on_but_new_clicked(self, widget):
|
||||
self.topwidget.set_visible_child(self.box['proj_edit'])
|
||||
@@ -50,7 +54,20 @@ class ProjectsView(View):
|
||||
self.topwidget.set_visible_child(self.box['proj_edit'])
|
||||
|
||||
def on_but_detail_clicked(self, widget):
|
||||
projid = treeview.get_value(self.tree['projects'], 0)
|
||||
if not projid:
|
||||
return
|
||||
self.project.load(projid)
|
||||
self.display_record()
|
||||
self.topwidget.set_visible_child(self.box['proj_detail'])
|
||||
self.button['close'].grab_focus()
|
||||
|
||||
def on_tvw_projects_row_activated(self, widget, path, column):
|
||||
projid = treeview.get_value(widget, 0)
|
||||
self.project.load(projid)
|
||||
self.display_record()
|
||||
self.topwidget.set_visible_child(self.box['proj_detail'])
|
||||
self.button['close'].grab_focus()
|
||||
|
||||
# buttons on detail page
|
||||
# edit2 uses edit callback
|
||||
@@ -68,7 +85,14 @@ class ProjectsView(View):
|
||||
self.topwidget.set_visible_child(self.box['projects'])
|
||||
|
||||
def display_record(self):
|
||||
pass
|
||||
self.label['name'].set_text(self.project.projname)
|
||||
self.label['responsible'].set_text(self.dd_user[self.project.responsible])
|
||||
self.label['date_start'].set_text(self.format_date(self.project.startdate))
|
||||
self.label['duration'].set_text(self.format_int(self.project.duration, suffix="Days"))
|
||||
self.label['costs_plan'].set_text(self.format_float(self.project.costs_plan, 2, suffix="€"))
|
||||
self.label['costs_final'].set_text(self.format_float(self.project.costs_final, 2, suffix="€"))
|
||||
self.label['status'].set_text(self.project.projstate)
|
||||
self.label['remarks'].set_text(self.project.remarks or '')
|
||||
|
||||
def edit_record(self):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user