~jconti/recent-notifications/trunk

« back to all changes in this revision

Viewing changes to unity/Main.py

  • Committer: Jason Conti
  • Date: 2011-04-17 17:16:26 UTC
  • Revision ID: jason.conti@gmail.com-20110417171626-oczxpamp3dllgixp
Renaming the .desktop file for the unity version and set the logging path back to ~/.cache/recent-notifications.log

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
from Notification import Notification
24
24
from Translations import _
25
25
 
 
26
# Setup the application logging to file and stdout for errors
 
27
def setup_logging():
 
28
  log_format = "%(asctime)s %(name)s %(levelname)s: %(message)s"
 
29
 
 
30
  logging.basicConfig(level=logging.DEBUG, 
 
31
      filename=os.path.expanduser("~/.cache/recent-notifications.log"),
 
32
      format=log_format,
 
33
      filemode="w")
 
34
 
 
35
  console = logging.StreamHandler()
 
36
  console.setLevel(logging.ERROR)
 
37
  console.setFormatter(logging.Formatter(log_format))
 
38
 
 
39
  logging.getLogger("").addHandler(console)
 
40
 
 
41
setup_logging()
26
42
logger = logging.getLogger("Main")
27
43
 
28
44
SCRIPT_PATH = os.path.dirname(os.path.abspath(__file__))
101
117
    self.initialize_combobox()
102
118
 
103
119
    if Unity:
104
 
      self._launcher = Unity.LauncherEntry.get_for_desktop_id("rn-unity.desktop")
 
120
      self._launcher = Unity.LauncherEntry.get_for_desktop_id("recent-notifications.desktop")
105
121
    else:
106
122
      self._launcher = None
107
123
 
202
218
    show_about()
203
219
 
204
220
def main():
205
 
  log_path = os.path.join(SCRIPT_PATH, "rn-unity.log")
206
 
  logging.basicConfig(filename=log_path, level=logging.DEBUG)
207
 
 
208
221
  icon_path = os.path.join(SCRIPT_PATH, "..", "icons")
209
222
  theme = Gtk.IconTheme.get_default()
210
223
  theme.append_search_path(icon_path)