Exemple #1
0
 def rm_clicked(self, jnk_unused):
     '''Handling click on the 'remove' button of the registration window
        Throws up an 'are you sure' dialog box, and delete if yes'''
     selection = self.treeview.get_selection()
     treeiter = selection.get_selected()[1]
     # if nothing is selected, do nothing.
     if treeiter:
         rmreg_dialog = MsgDialog(self, 'warning', ['yes', 'no'], 'Really delete?', 'Are you sure you want to delete this entry?\nThis cannot be undone.')
         rmreg_dialog.set_default_response(Gtk.ResponseType.NO)
         response = rmreg_dialog.run()
         rmreg_dialog.destroy()
         if response == Gtk.ResponseType.YES:
             # Grab the current information.
             current_info = {}
             for (colid, field) in enumerate(self.fields):
                 current_info[field] = self.modelfiltersorted.get_value(treeiter, colid)
             # Find where this is in self.prereg
             preregiter = self.prereg.index(current_info)
             # converts the treeiter from sorted to filter to model, and remove
             self.regmodel.remove(self.modelfilter.convert_iter_to_child_iter(self.modelfiltersorted.convert_iter_to_child_iter(treeiter)))
             try:
                 self.ids.remove(current_info['ID'])
             except:
                 pass
             self.prereg.pop(preregiter)
             # The latest stuff has no longer been saved.
             self.regstatus.set_markup('')
Exemple #2
0
 def restart_t0(self, jnk_unused):
     '''Handles click on restart clock button'''
     restart_t0_dialog = MsgDialog(self, 'warning', ['yes', 'no'], 'Are you sure?', 
                                   'Are you sure you want to restart the race clock?\nThis cannot be undone.')
     restart_t0_dialog.set_default_response(Gtk.ResponseType.NO)
     response = restart_t0_dialog.run()
     restart_t0_dialog.destroy()
     if response == Gtk.ResponseType.YES:
         self.t0 = time.time()
Exemple #3
0
 def restart_t0(self, jnk_unused):
     '''Handles click on restart clock button'''
     restart_t0_dialog = MsgDialog(
         self, 'warning', ['yes', 'no'], 'Are you sure?',
         'Are you sure you want to restart the race clock?\nThis cannot be undone.'
     )
     restart_t0_dialog.set_default_response(Gtk.ResponseType.NO)
     response = restart_t0_dialog.run()
     restart_t0_dialog.destroy()
     if response == Gtk.ResponseType.YES:
         self.t0 = time.time()
Exemple #4
0
 def close_clicked(self, jnk_unused):
     '''Handles click on the 'close' button on the registration window.
        Throws up a 'do you want to save' dialog, and close the window'''
     okreg_dialog = MsgDialog(self, 'question', ['yes', 'no'], 'Save?', 'Do you want to save before finishing?\nUnsaved data will be lost.')
     okreg_dialog.set_default_response(Gtk.ResponseType.YES)
     response = okreg_dialog.run()
     okreg_dialog.destroy()
     if response == Gtk.ResponseType.YES:
         # this will save
         save_res = self.save_clicked(None)
         if not save_res:
             return
     self.hide()
     # Clear the file setting from pre-reg, in case pre-reg is
     # re-run without selecting a file
     del self.prereg[:]
Exemple #5
0
 def timing_rm_time(self, jnk_unused):
     '''Handles click on Drop time comment
        Throws up an 'are you sure' dialog box, and drop if yes.'''
     treeselection = self.timeview.get_selection()
     pathlist = treeselection.get_selected_rows()[1]
     if len(pathlist) == 0:
         # we don't load any windows or do anything
         pass
     elif len(pathlist) > 1:
         # this is a one-at-a-time operation
         pass
     elif len(pathlist) == 1:
         # Figure out what row this is in the timeview
         row = pathlist[0][0]
         # Now figure out what index in self.rawtimes['times'] it is.
         timeidx = row - max(0, -self.offset)
         if timeidx >= 0:
             # Otherwise, there is no time here so there is nothing to do.
             # Ask if we are sure.
             rmtime_dialog = MsgDialog(
                 self, 'warning', ['yes', 'no'], 'Are you sure?',
                 'Are you sure you want to drop this time and shift all later times down earlier in the list?\nThis cannot be undone.'
             )
             rmtime_dialog.set_default_response(Gtk.ResponseType.NO)
             response = rmtime_dialog.run()
             rmtime_dialog.destroy()
             if response == Gtk.ResponseType.YES:
                 # Make the shift in self.rawtimes and self.offset
                 self.rawtimes['times'].pop(timeidx)
                 self.offset -= 1
                 # And now shift everything on the display.
                 rowcounter = int(row)
                 for i in range(timeidx - 1, -1, -1):
                     # Write rawtimes[i] into row rowcounter
                     treeiter = self.timemodel.get_iter((rowcounter, ))
                     self.timemodel.set_value(
                         treeiter, 1, str(self.rawtimes['times'][i]))
                     rowcounter -= 1
                 # Now we tackle the last value - there are two possibilities.
                 if self.offset < 0:
                     # There is a buffer of IDs, and this one should be cleared.
                     treeiter = self.timemodel.get_iter((rowcounter, ))
                     self.timemodel.set_value(treeiter, 1, '')
                 else:
                     # there is a blank row at the top which should be removed.
                     treeiter = self.timemodel.get_iter((rowcounter, ))
                     self.timemodel.remove(treeiter)
Exemple #6
0
 def timing_rm_time(self, jnk_unused):
     '''Handles click on Drop time comment
        Throws up an 'are you sure' dialog box, and drop if yes.'''
     treeselection = self.timeview.get_selection()
     pathlist = treeselection.get_selected_rows()[1]
     if len(pathlist) == 0:
         # we don't load any windows or do anything
         pass
     elif len(pathlist) > 1:
         # this is a one-at-a-time operation
         pass
     elif len(pathlist) == 1:
         # Figure out what row this is in the timeview
         row = pathlist[0][0]
         # Now figure out what index in self.rawtimes['times'] it is.
         timeidx = row-max(0, -self.offset)
         if timeidx >= 0:
             # Otherwise, there is no time here so there is nothing to do.
             # Ask if we are sure.
             rmtime_dialog = MsgDialog(self, 'warning', ['yes', 'no'], 'Are you sure?', 'Are you sure you want to drop this time and shift all later times down earlier in the list?\nThis cannot be undone.')
             rmtime_dialog.set_default_response(Gtk.ResponseType.NO)
             response = rmtime_dialog.run()
             rmtime_dialog.destroy()
             if response == Gtk.ResponseType.YES:
                 # Make the shift in self.rawtimes and self.offset
                 self.rawtimes['times'].pop(timeidx)
                 self.offset -= 1
                 # And now shift everything on the display.
                 rowcounter = int(row)
                 for i in range(timeidx-1, -1, -1):
                     # Write rawtimes[i] into row rowcounter
                     treeiter = self.timemodel.get_iter((rowcounter,))
                     self.timemodel.set_value(treeiter, 1, str(self.rawtimes['times'][i]))
                     rowcounter -= 1
                 # Now we tackle the last value - there are two possibilities.
                 if self.offset < 0:
                     # There is a buffer of IDs, and this one should be cleared.
                     treeiter = self.timemodel.get_iter((rowcounter,))
                     self.timemodel.set_value(treeiter, 1, '')
                 else:
                     # there is a blank row at the top which should be removed.
                     treeiter = self.timemodel.get_iter((rowcounter,))
                     self.timemodel.remove(treeiter)