2
# -*- coding: utf-8 -*-
4
# This file is in the public domain
12
from gettext import gettext as _
13
gettext.textdomain('project_name')
15
# optional Launchpad integration
16
# this shouldn't crash if not found as it is simply used for bug reporting
18
import LaunchpadIntegration
19
launchpad_available = True
21
launchpad_available = False
23
# Add project root directory (enable symlink, and trunk execution).
24
PROJECT_ROOT_DIRECTORY = os.path.abspath(
25
os.path.dirname(os.path.dirname(os.path.realpath(sys.argv[0]))))
27
if (os.path.exists(os.path.join(PROJECT_ROOT_DIRECTORY, 'python_name'))
28
and PROJECT_ROOT_DIRECTORY not in sys.path):
29
sys.path.insert(0, PROJECT_ROOT_DIRECTORY)
30
os.putenv('PYTHONPATH', PROJECT_ROOT_DIRECTORY) # for subprocesses
32
from python_name import (
33
Aboutcamel_case_nameDialog, Preferencescamel_case_nameDialog)
34
from python_name.helpers import get_builder
37
class camel_case_nameWindow(gtk.Window):
38
__gtype_name__ = "camel_case_nameWindow"
40
# To construct a new instance of this method, the following notable
41
# methods are called in this order:
44
# finish_initializing(self, builder)
47
# For this reason, it's recommended you leave __init__ empty and put
48
# your inialization code in finish_intializing
51
"""Special static method that's automatically called by Python when
52
constructing a new instance of this class.
54
Returns a fully instantiated camel_case_nameWindow object.
56
builder = get_builder('camel_case_nameWindow')
57
new_object = builder.get_object("python_name_window")
58
new_object.finish_initializing(builder)
61
def finish_initializing(self, builder):
62
"""Called while initializing this instance in __new__
64
finish_initalizing should be called after parsing the UI definition
65
and creating a camel_case_nameWindow object with it in order to finish
66
initializing the start of the new camel_case_nameWindow instance.
68
Put your initilization code in here and leave __init__ undefined.
70
# Get a reference to the builder and set up the signals.
71
self.builder = builder
72
self.builder.connect_signals(self)
74
global launchpad_available
75
if launchpad_available:
76
# see https://wiki.ubuntu.com/UbuntuDevelopment/Internationalisation/Coding for more information
77
# about LaunchpadIntegration
78
helpmenu = self.builder.get_object('helpMenu')
80
LaunchpadIntegration.set_sourcepackagename('project_name')
81
LaunchpadIntegration.add_items(helpmenu, 0, False, True)
83
launchpad_available = False
85
# Uncomment the following code to read in preferences at start up.
86
#dlg = Preferencescamel_case_nameDialog.NewPreferencescamel_case_nameDialog()
87
#self.preferences = dlg.get_preferences()
89
# Code for other initialization actions should be added here.
91
def about(self, widget, data=None):
92
"""Display the about box for project_name."""
93
about = Aboutcamel_case_nameDialog.Aboutcamel_case_nameDialog()
94
response = about.run()
97
def preferences(self, widget, data=None):
98
"""Display the preferences window for project_name."""
99
prefs = Preferencescamel_case_nameDialog.Preferencescamel_case_nameDialog()
100
response = prefs.run()
101
if response == gtk.RESPONSE_OK:
102
# Make any updates based on changed preferences here.
106
def quit(self, widget, data=None):
107
"""Signal handler for closing the camel_case_nameWindow."""
110
def on_destroy(self, widget, data=None):
111
"""Called when the camel_case_nameWindow is closed."""
112
# Clean up code for saving application state should be added here.
115
if __name__ == "__main__":
116
# Support for command line options.
119
parser = optparse.OptionParser(version="%prog %ver")
121
"-v", "--verbose", action="store_true", dest="verbose",
122
help=_("Show debug messages"))
123
(options, args) = parser.parse_args()
125
# Set the logging level to show debug messages.
127
logging.basicConfig(level=logging.DEBUG)
128
logging.debug('logging enabled')
130
# Run the application.
131
window = camel_case_nameWindow()