'''eventgui.py -- gui for programstalta.py

usage: python eventgui.py [options]

options:
    -h            print this
    -t ttktheme   use theme ttktheme [alt]
    -l            list available themes and exit
'''

version = "1.10"
lastchangedate = "2014-12-26"

import sys
import getopt
import posixpath as pp
import pprint

from Tkinter import *
import ttk
import tkFont
import tkFileDialog
import tkMessageBox

import base
from serialports import serialports
from logger import log
from programstalta import main as pgmmain
from programstalta import version as pgmversion


def force_suffix(fname, suffix):
    """won't suffix a directory.
    second argument should not start with a period."""
    head, tail = pp.split(fname)
    if len(tail) == 0:
        return head
    if suffix[0] == ".":
        suffix = suffix[1:]
    fpart, fext = pp.splitext(tail)
    newp = pp.join(head, fpart + "." + suffix)
    return pp.normpath(newp)


class App(object):

    def __init__(self, theme):

        self.root = Tk()
        master = ttk.Frame(self.root)
        self.frame = master
        master.pack(expand=True, fill='both')

        deff = tkFont.Font(size = 14, weight = tkFont.BOLD)
        hedf = tkFont.Font(size = 16, weight = tkFont.BOLD)
        entf = tkFont.Font(size = 14, slant = tkFont.ITALIC,
                           weight = tkFont.BOLD)
        lblf = tkFont.Font(size = 12, weight = tkFont.BOLD)
        btnf = tkFont.Font(size = 12, slant = tkFont.ITALIC,
                           weight = tkFont.BOLD)
        abtnf = tkFont.Font(size = 14, weight = tkFont.BOLD)
        opnf = tkFont.Font(size = 14, slant = tkFont.ITALIC)
        ckbf = tkFont.Font(size = 12, weight = tkFont.BOLD)

        lblfg = "darkblue"