# 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, re
import fstimer.gui
from gi.repository import Gtk
from os.path import normpath, join, dirname, abspath
from fstimer.gui.util_classes import GtkStockButton
        self.set_border_width(20)
        self.connect('delete_event', lambda b, jnk_unused: self.hide())
        # Now create the vbox.
        vbox = Gtk.VBox(False, 10)
        self.add(vbox)
        # Now add the text.
        label_0 = Gtk.Label('Enter a name for the new project.\nOnly letters, numbers, and underscore.')
        # And an error, if needed..
        self.label_1 = Gtk.Label()
        self.label_1.set_line_wrap(True)
        # And the text entry
        self.entry = Gtk.Entry()
        self.entry.set_max_length(32)
        # Select a file to import, if desired
        label_2 = Gtk.Label('Select a project to import settings from (optional)')
        # A combobox to select the project
        combobox = Gtk.ComboBoxText()
        projectlist = ["-- No import --"]
        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)
        # And an hbox with 2 buttons
        hbox_1 = Gtk.HBox(False, 0)
        btnCANCEL = GtkStockButton('close',"Close")
        btnCANCEL.connect('clicked', lambda btn: self.hide())
        alignCANCEL = Gtk.Alignment.new(0, 0, 0, 0)
        alignCANCEL.add(btnCANCEL)

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

        self.set_border_width(20)
        self.connect('delete_event', lambda b, jnk_unused: self.hide())
        # Now create the vbox.
        vbox = Gtk.VBox(False, 10)
        self.add(vbox)
        # Now add the text.
        label_0 = Gtk.Label('Enter a name for the new project.\nOnly letters, numbers, and underscore.')
        # And an error, if needed..
        self.label_1 = Gtk.Label()
        self.label_1.set_line_wrap(True)
        # And the text entry
        self.entry = Gtk.Entry()
        self.entry.set_max_length(32)
        # Select a file to import, if desired
        label_2 = Gtk.Label('Select a project to import settings from (optional)')
        # A combobox to select the project
        combobox = Gtk.ComboBoxText()
        projectlist = ["-- No import --"]
        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)
        # And an hbox with 2 buttons
        hbox_1 = Gtk.HBox(False, 0)
        btnCANCEL = GtkStockButton('close',"Close")
        btnCANCEL.connect('clicked', lambda btn: self.hide())
        alignCANCEL = Gtk.Alignment.new(0, 0, 0, 0)
        alignCANCEL.add(btnCANCEL)

        btnNEXT = GtkStockButton('forward',"Next")