#!/usr/bin/env python3

# import what we need first, complain if we don't find it
import sys
from kdj import constants

stop=False
if len(sys.argv)>1:
  arg=sys.argv[1]
  if arg=='-V' or arg=='--version':
    print(constants.kdj_name_version+', a remuxing program for Kate streams.\n')
    stop=True
  elif arg=='-h' or arg=='--help':
    print(constants.kdj_name_version+', a remuxing program for Kate streams.\n')
    print('\n'+\
          constants.kdj_name+' is a remuxing program that allows extracting and decoding Kate tracks\n'+\
          'from an Ogg stream, and recreating that Ogg stream after the Kate streams\n'+\
          'have been altered.\n'+\
          constants.kdj_name+' requires both the Kate tools (kateenc and katedec) and the oggz tools.\n'+\
          '\n'+\
          'This is a GUI program. Click the \'Help\' button in the main window for more help.\n')
    stop=True
  else:
    print('Invalid option: '+arg)
    sys.exit(1)

if stop:
  sys.exit(0)

try:
  import wx
except:
  print('Failed to find the wx Python module')
  sys.exit(1)

# import our own code
from kdj.ui_main import UIMain

app=wx.PySimpleApp()
wx.InitAllImageHandlers()
ui_main=UIMain()
app.MainLoop()

