# 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
        column = Gtk.TreeViewColumn('Division', ranking_renderer, text=0)
        self.rankingview.append_column(column)
        #Prepare the combobox liststore
        liststore_fields = Gtk.ListStore(str)
        for field in self.fieldslist:
            liststore_fields.append([field])
        combo_renderer = Gtk.CellRendererCombo()
        combo_renderer.set_property("editable", True)
        combo_renderer.set_property("model", liststore_fields)
        combo_renderer.set_property("text-column", 0)
        combo_renderer.set_property("has-entry", False)
        combo_renderer.connect("edited", self.ranking_edit)
        column = Gtk.TreeViewColumn('Rank by:', combo_renderer, text=1)
        self.rankingview.append_column(column)
        # Create scrolled window, in an alignment
        rankingsw = Gtk.ScrolledWindow()
        rankingsw.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
        rankingsw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        rankingsw.add(self.rankingview)
        rankingalgn = Gtk.Alignment.new(0, 0, 1, 1)
        rankingalgn.add(rankingsw)
        # And an hbox for the fields and the buttons
        hbox4 = Gtk.HBox(False, 0)
        hbox4.pack_start(rankingalgn, True, True, 10)
        # Add an hbox with 3 buttons
        hbox3 = 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/definerankings.py
import gi
import fstimer.gui
from gi.repository import Gtk
from fstimer.gui.util_classes import GtkStockButton

        column = Gtk.TreeViewColumn('Division', ranking_renderer, text=0)
        self.rankingview.append_column(column)
        #Prepare the combobox liststore
        liststore_fields = Gtk.ListStore(str)
        for field in self.fieldslist:
            liststore_fields.append([field])
        combo_renderer = Gtk.CellRendererCombo()
        combo_renderer.set_property("editable", True)
        combo_renderer.set_property("model", liststore_fields)
        combo_renderer.set_property("text-column", 0)
        combo_renderer.set_property("has-entry", False)
        combo_renderer.connect("edited", self.ranking_edit)
        column = Gtk.TreeViewColumn('Rank by:', combo_renderer, text=1)
        self.rankingview.append_column(column)
        # Create scrolled window, in an alignment
        rankingsw = Gtk.ScrolledWindow()
        rankingsw.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
        rankingsw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        rankingsw.add(self.rankingview)
        rankingalgn = Gtk.Alignment.new(0, 0, 1, 1)
        rankingalgn.add(rankingsw)
        # And an hbox for the fields and the buttons
        hbox4 = Gtk.HBox(False, 0)
        hbox4.pack_start(rankingalgn, True, True, 10)
        # Add an hbox with 3 buttons
        hbox3 = 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)

        btnBACK = GtkStockButton('back',"Back")