#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2012 S. Daniel Francis # # 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 3 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, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. import os import logging logging.basicConfig(level=logging.DEBUG) import glib import info logger = logging.getLogger(info.lower_name) appname = info.name import sweetener if sweetener.GTK == 2: from applicationgtk2 import Application else: from applicationgtk3 import Application if __name__ == '__main__': logger.debug('Initializing %s' % info.name) import sys if info.io_mode == info.DOCUMENT: if len(sys.argv) > 1: logger.debug('Open from args %s' % sys.argv[1]) if os.path.exists(sys.argv[1]): file_path = sys.argv[1] logger.debug('Found file') else: file_path = None logger.error('Could not find file') else: file_path = None logger.debug('Create new file') else: if os.path.exists(os.path.join(os.environ['HOME'], '.' + info.lower_name)): file_path = os.path.join(os.environ['HOME'], '.' + info.lower_name) else: file_path = None window = Application() window.file_path = file_path window.start() logger.debug('Closing %s' % info.name) exit()