# 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
        alignCANCEL.add(btnCANCEL)
        btnNEXT = GtkStockButton('forward',"Next")
        btnNEXT.connect('clicked', self.nextClicked, set_projecttype_cb, projectlist, combobox)
        alignNEXT = Gtk.Alignment.new(1, 0, 1, 0)
        alignNEXT.add(btnNEXT)
        btnNEXT.set_sensitive(False)
        # And populate
        self.entry.connect("changed", self.lock_btn_title, btnNEXT)
        hbox_1.pack_start(alignCANCEL, True, True, 0)
        hbox_1.pack_start(alignNEXT, False, False, 0)
        vbox.pack_start(label_0, False, False, 0)
        vbox.pack_start(self.entry, False, False, 0)
        vbox.pack_start(self.label_1, False, False, 0)
        vbox.pack_start(label_2, False, False, 0)
        vbox.pack_start(combobox, False, False, 0)
        vbox.pack_start(hbox_1, False, False, 0)
        self.show_all()

    def lock_btn_title(self, jnk_unused, btnNEXT):
        '''locks btnNEXT if the project name doesn't meet specifications'''
        txt = self.entry.get_text()
        btnNEXT.set_sensitive((len(txt) > 0) and \
                              (not re.search('[^a-zA-Z0-9_]+', txt)))
        return

    def nextClicked(self, jnk_unused, set_projecttype_cb, projectlist, combobox):
        '''handles click on next by checking new project name
           and calling back fsTimer'''
        entry_text = str(self.entry.get_text())
        path = normpath(join(dirname(dirname(dirname(abspath(__file__)))), entry_text))

# 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

        alignCANCEL.add(btnCANCEL)
        btnNEXT = GtkStockButton('forward',"Next")
        btnNEXT.connect('clicked', self.nextClicked, set_projecttype_cb, projectlist, combobox)
        alignNEXT = Gtk.Alignment.new(1, 0, 1, 0)
        alignNEXT.add(btnNEXT)
        btnNEXT.set_sensitive(False)
        # And populate
        self.entry.connect("changed", self.lock_btn_title, btnNEXT)
        hbox_1.pack_start(alignCANCEL, True, True, 0)
        hbox_1.pack_start(alignNEXT, False, False, 0)
        vbox.pack_start(label_0, False, False, 0)
        vbox.pack_start(self.entry, False, False, 0)
        vbox.pack_start(self.label_1, False, False, 0)
        vbox.pack_start(label_2, False, False, 0)
        vbox.pack_start(combobox, False, False, 0)
        vbox.pack_start(hbox_1, False, False, 0)
        self.show_all()

    def lock_btn_title(self, jnk_unused, btnNEXT):
        '''locks btnNEXT if the project name doesn't meet specifications'''
        txt = self.entry.get_text()
        btnNEXT.set_sensitive((len(txt) > 0) and \
                              (not re.search('[^a-zA-Z0-9_]+', txt)))
        return

    def nextClicked(self, jnk_unused, set_projecttype_cb, projectlist, combobox):
        '''handles click on next by checking new project name
           and calling back fsTimer'''
        entry_text = str(self.entry.get_text())
        path = normpath(join(dirname(dirname(dirname(abspath(__file__)))), entry_text))

        if os.path.exists(path):