# 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 os
import fstimer.gui
from gi.repository import Gtk
from os.path import normpath, join, dirname, abspath
from fstimer.gui.util_classes import GtkStockButton
        self.modify_bg(Gtk.StateType.NORMAL, fstimer.gui.bgcolor)
        icon_fname = normpath(join(dirname(abspath(__file__)),'../data/icon.png'))
        self.set_icon_from_file(icon_fname)
        self.set_title('fsTimer')
        self.set_position(Gtk.WindowPosition.CENTER)
        self.set_border_width(20)
        self.connect('delete_event', Gtk.main_quit)
        # Create the vbox that will contain everything
        vbox = Gtk.VBox(False, 10)
        self.add(vbox)
        # Main logo
        logo = Gtk.Image()
        logo.set_from_file(normpath(join(dirname(abspath(__file__)),'../data/fstimer_logo.png')))
        # Welcome text
        label0 = Gtk.Label(label='')
        label = Gtk.Label('Select an existing project, or begin a new project.')
        # A combobox to select the project
        combobox = Gtk.ComboBoxText()
        projectlist = [' -- Select an existing project --']
        rootdir = normpath(join(dirname(abspath(__file__)),'../../'))
        projectlist.extend([i for i in os.listdir(rootdir) if os.path.isdir(join(rootdir,i)) and os.path.exists(join(rootdir,i+'/'+i+'.reg'))]) #List the folders in pwd that contain a .reg registration file
        projectlist.sort()
        for project in projectlist:
            combobox.append_text(project)
        combobox.set_active(0)
        #An hbox for the buttons.
        hbox = Gtk.HBox(False, 0)
        #And build the buttons
        btnNEW = GtkStockButton('new','New')
        btnNEW.connect('clicked', create_project_cb)

# 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/intro.py
import gi
import os
import fstimer.gui
from gi.repository import Gtk
from os.path import normpath, join, dirname, abspath
from fstimer.gui.util_classes import GtkStockButton

        self.modify_bg(Gtk.StateType.NORMAL, fstimer.gui.bgcolor)
        icon_fname = normpath(join(dirname(abspath(__file__)),'../data/icon.png'))
        self.set_icon_from_file(icon_fname)
        self.set_title('fsTimer')
        self.set_position(Gtk.WindowPosition.CENTER)
        self.set_border_width(20)
        self.connect('delete_event', Gtk.main_quit)
        # Create the vbox that will contain everything
        vbox = Gtk.VBox(False, 10)
        self.add(vbox)
        # Main logo
        logo = Gtk.Image()
        logo.set_from_file(normpath(join(dirname(abspath(__file__)),'../data/fstimer_logo.png')))
        # Welcome text
        label0 = Gtk.Label(label='')
        label = Gtk.Label('Select an existing project, or begin a new project.')
        # A combobox to select the project
        combobox = Gtk.ComboBoxText()
        projectlist = [' -- Select an existing project --']
        rootdir = normpath(join(dirname(abspath(__file__)),'../../'))
        projectlist.extend([i for i in os.listdir(rootdir) if os.path.isdir(join(rootdir,i)) and os.path.exists(join(rootdir,i+'/'+i+'.reg'))]) #List the folders in pwd that contain a .reg registration file
        projectlist.sort()
        for project in projectlist:
            combobox.append_text(project)
        combobox.set_active(0)
        #An hbox for the buttons.
        hbox = Gtk.HBox(False, 0)
        #And build the buttons
        btnNEW = GtkStockButton('new','New')
        btnNEW.connect('clicked', create_project_cb)

        btnOK = GtkStockButton('ok','OK')