# Path: fstimer/gui/util_classes.py
# class GtkStockButton(Gtk.Button):
#     
#     def __init__(self, icon_name, label_text):
#         #Init a regular Gtk.Button
#         Gtk.Button.__init__(self)
#         #Add the icon and the label.
#         fname = os.path.join(icon_path, icon_files[icon_name])
#         btnIcon = Gtk.Image.new_from_file(fname)
#         btnLabel = Gtk.Label(label_text+' ')
#         #pack 'em into an HBox
#         btnHbox = Gtk.HBox(False, 0)
#         btnHbox.pack_start(btnIcon, False, False, 0)
#         btnHbox.pack_start(btnLabel, True, True, 0)
#         self.add(btnHbox)
#         return


import gi
import fstimer.gui
from gi.repository import Gtk
from fstimer.gui.util_classes import GtkStockButton
    def __init__(self, timewin, old_id, old_time, clickedok_cb):
        '''Builds and display the window for editing a single time'''
        super(EditTimeWin, self).__init__(Gtk.WindowType.TOPLEVEL)
        self.timewin = timewin
        self.clickedok_cb = clickedok_cb
        self.modify_bg(Gtk.StateType.NORMAL, fstimer.gui.bgcolor)
        self.set_transient_for(timewin)
        self.set_modal(True)
        self.set_title('fsTimer - Edit time')
        self.set_position(Gtk.WindowPosition.CENTER)
        self.set_border_width(20)
        self.connect('delete_event', lambda b, jnk: self.hide())
        label0 = Gtk.Label(label='')
        label0.set_markup('<span color="red">WARNING: Changes to these values cannot be automatically undone</span>\nIf you change the time and forget the old one, it will be gone forever.')
        label1 = Gtk.Label(label='ID:')
        self.entryid = Gtk.Entry()
        self.entryid.set_max_length(6)
        self.entryid.set_text(old_id)
        hbox1 = Gtk.HBox(False, 10)
        hbox1.pack_start(label1, False, False, 0)
        hbox1.pack_start(self.entryid, False, False, 0)
        label2 = Gtk.Label(label='Time:')
        self.entrytime = Gtk.Entry()
        self.entrytime.set_max_length(25)
        self.entrytime.set_text(old_time)
        hbox2 = Gtk.HBox(False, 10)
        hbox2.pack_start(label2, False, False, 0)
        hbox2.pack_start(self.entrytime, False, False, 0)
        btnOK = GtkStockButton('ok',"OK")
        btnOK.connect('clicked', self.winedittimeOK)

# Path: fstimer/gui/util_classes.py
# class GtkStockButton(Gtk.Button):
#     
#     def __init__(self, icon_name, label_text):
#         #Init a regular Gtk.Button
#         Gtk.Button.__init__(self)
#         #Add the icon and the label.
#         fname = os.path.join(icon_path, icon_files[icon_name])
#         btnIcon = Gtk.Image.new_from_file(fname)
#         btnLabel = Gtk.Label(label_text+' ')
#         #pack 'em into an HBox
#         btnHbox = Gtk.HBox(False, 0)
#         btnHbox.pack_start(btnIcon, False, False, 0)
#         btnHbox.pack_start(btnLabel, True, True, 0)
#         self.add(btnHbox)
#         return


# Path: fstimer/gui/edittime.py
import gi
import fstimer.gui
from gi.repository import Gtk
from fstimer.gui.util_classes import GtkStockButton

    def __init__(self, timewin, old_id, old_time, clickedok_cb):
        '''Builds and display the window for editing a single time'''
        super(EditTimeWin, self).__init__(Gtk.WindowType.TOPLEVEL)
        self.timewin = timewin
        self.clickedok_cb = clickedok_cb
        self.modify_bg(Gtk.StateType.NORMAL, fstimer.gui.bgcolor)
        self.set_transient_for(timewin)
        self.set_modal(True)
        self.set_title('fsTimer - Edit time')
        self.set_position(Gtk.WindowPosition.CENTER)
        self.set_border_width(20)
        self.connect('delete_event', lambda b, jnk: self.hide())
        label0 = Gtk.Label(label='')
        label0.set_markup('<span color="red">WARNING: Changes to these values cannot be automatically undone</span>\nIf you change the time and forget the old one, it will be gone forever.')
        label1 = Gtk.Label(label='ID:')
        self.entryid = Gtk.Entry()
        self.entryid.set_max_length(6)
        self.entryid.set_text(old_id)
        hbox1 = Gtk.HBox(False, 10)
        hbox1.pack_start(label1, False, False, 0)
        hbox1.pack_start(self.entryid, False, False, 0)
        label2 = Gtk.Label(label='Time:')
        self.entrytime = Gtk.Entry()
        self.entrytime.set_max_length(25)
        self.entrytime.set_text(old_time)
        hbox2 = Gtk.HBox(False, 10)
        hbox2.pack_start(label2, False, False, 0)
        hbox2.pack_start(self.entrytime, False, False, 0)
        btnOK = GtkStockButton('ok',"OK")
        btnOK.connect('clicked', self.winedittimeOK)

        btnCANCEL = GtkStockButton('close',"Cancel")