2014-10-27 16:29:04 -06:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
""" TW Blue
|
|
|
|
|
|
|
|
A twitter accessible, easy of use and cross platform application."""
|
|
|
|
############################################################
|
|
|
|
# Copyright(C)2013-2014 Manuel Eduardo Cortéz Vallejo <manuel@manuelcortez.net>
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
############################################################
|
|
|
|
import wx
|
2014-11-27 07:18:05 -06:00
|
|
|
import os
|
2014-10-27 16:29:04 -06:00
|
|
|
ssmg = None
|
|
|
|
import gui
|
|
|
|
import paths
|
|
|
|
import config
|
|
|
|
import commandline
|
|
|
|
import platform
|
2014-11-26 05:43:13 -06:00
|
|
|
from logger import logger as logging
|
2014-10-27 16:29:04 -06:00
|
|
|
from sessionmanager import manager
|
|
|
|
from sessionmanager import gui as smGUI
|
|
|
|
manager.setup()
|
|
|
|
import sys
|
2014-11-27 07:18:05 -06:00
|
|
|
import config
|
|
|
|
import output
|
|
|
|
import sound
|
|
|
|
import languageHandler
|
2014-10-27 16:29:04 -06:00
|
|
|
|
|
|
|
if hasattr(sys, 'frozen'):
|
|
|
|
sys.stderr = open(paths.logs_path("stderr.log"), 'w')
|
|
|
|
sys.stdout = open(paths.logs_path("stdout.log"), 'w')
|
|
|
|
|
2014-11-26 05:43:13 -06:00
|
|
|
app = wx.App()
|
2014-11-29 11:07:06 -06:00
|
|
|
#app = wx.App(redirect=True, useBestVisual=True, filename=paths.logs_path('tracebacks.log'))
|
2014-11-27 07:18:05 -06:00
|
|
|
configured = False
|
|
|
|
configs = []
|
|
|
|
for i in os.listdir(paths.config_path()):
|
|
|
|
if os.path.isdir(paths.config_path(i)): configs.append(i)
|
|
|
|
if len(configs) == 1:
|
|
|
|
manager.manager.set_current_session(configs[0])
|
|
|
|
config.MAINFILE = "%s/session.conf" % (manager.manager.get_current_session())
|
|
|
|
config.setup()
|
|
|
|
lang=config.main['general']['language']
|
|
|
|
languageHandler.setLanguage(lang)
|
|
|
|
sound.setup()
|
|
|
|
output.setup()
|
|
|
|
configured = True
|
|
|
|
else:
|
|
|
|
ssmg = smGUI.sessionManagerWindow()
|
|
|
|
if configured == True or ssmg.ShowModal() == wx.ID_OK:
|
2014-11-26 05:43:13 -06:00
|
|
|
frame = gui.main.mainFrame()
|
|
|
|
frame.Show()
|
|
|
|
frame.showing = True
|
|
|
|
if config.main != None and config.main["general"]["hide_gui"] == True and platform.system() == "Windows":
|
|
|
|
frame.show_hide()
|
|
|
|
frame.Hide()
|
|
|
|
app.SetTopWindow(frame)
|
|
|
|
else:
|
|
|
|
app.Exit()
|
2014-10-27 16:29:04 -06:00
|
|
|
### I should uncomment this
|
|
|
|
#if platform.system() != "Windows":
|
|
|
|
# local = wx.Locale(wx.LANGUAGE_DEFAULT)
|
|
|
|
# local.AddCatalogLookupPathPrefix(paths.locale_path())
|
|
|
|
# local.AddCatalog("twblue")
|
|
|
|
#ap = app(redirect=True, useBestVisual=True, filename=paths.logs_path('tracebacks.log'))
|
|
|
|
#wx.CallLater(10, start)
|
2014-11-26 05:43:13 -06:00
|
|
|
app.MainLoop()
|
2014-10-27 16:29:04 -06:00
|
|
|
|