コード例 #1
0
ファイル: manager.py プロジェクト: TWBlueQS/TWBlueQS
 def add_session(self, id):
  log.debug("Adding a new session: %s" % (id,))
  path = paths.config_path(id)
  if not os.path.exists(path):
   log.debug("Creating %s path" % (paths.config_path(path),))
   os.mkdir(path)
   config.app["sessions"]["sessions"].append(id)
コード例 #2
0
ファイル: session.py プロジェクト: TWBlueQS/TWBlueQS
 def shelve(self):
  "Shelve the database to allow for persistance."
  shelfname=paths.config_path(str(self.session_id)+"/cache.db")
  if self.settings["general"]["persist_size"] == 0:
   if os.path.exists(shelfname):
    os.remove(shelfname)
   return
  try:
   if not os.path.exists(shelfname):
    output.speak("Generating database, this might take a while.",True)
   shelf=shelve.open(paths.config_path(shelfname),'c')
   for key,value in self.db.items():
    if type(key) != str and type(key) != unicode:
        output.speak("Uh oh, while shelving the database, a key of type " + str(type(key)) + " has been found. It will be converted to type str, but this will cause all sorts of problems on deshelve. Please bring this to the attention of the " + application.name + " developers immediately. More information about the error will be written to the error log.",True)
        log.error("Uh oh, " + str(key) + " is of type " + str(type(key)) + "!")
    # Convert unicode objects to UTF-8 strings before shelve these objects.
    if type(value) == list and self.settings["general"]["persist_size"] != -1 and len(value) > self.settings["general"]["persist_size"]:
        shelf[str(key.encode("utf-8"))]=value[self.settings["general"]["persist_size"]:]
    else:
        shelf[str(key.encode("utf-8"))]=value
   shelf.close()
  except:
   output.speak("An exception occurred while shelving the " + application.name + " database. It will be deleted and rebuilt automatically. If this error persists, send the error log to the " + application.name + " developers.",True)
   log.exception("Exception while shelving" + shelfname)
   os.remove(shelfname)
コード例 #3
0
 def add_session(self, id):
     log.debug("Adding a new session: %s" % (id, ))
     path = paths.config_path(id)
     if not os.path.exists(path):
         log.debug("Creating %s path" % (paths.config_path(path), ))
         os.mkdir(path)
         config.app["sessions"]["sessions"].append(id)
コード例 #4
0
ファイル: config.py プロジェクト: TWBlueQS/TWBlueQS
def setup ():
 global app
 log.debug("Loading global app settings...")
 app = config_utils.load_config(paths.config_path(MAINFILE), paths.app_path(MAINSPEC))
 log.debug("Loading keymap...")
 global keymap
 keymap = config_utils.load_config(paths.config_path("keymap.keymap"), paths.app_path("keymaps/"+app['app-settings']['load_keymap']))
コード例 #5
0
 def shelve(self):
  "Shelve the database to allow for persistance."
  shelfname=paths.config_path(str(self.session_id)+"/cache.db")
  if self.settings["general"]["persist_size"] == 0:
   if os.path.exists(shelfname):
    os.remove(shelfname)
   return
  try:
   if not os.path.exists(shelfname):
    output.speak("Generating database, this might take a while.",True)
   shelf=shelve.open(paths.config_path(shelfname),'c')
   for key,value in self.db.items():
    if type(key) != str and type(key) != unicode:
        output.speak("Uh oh, while shelving the database, a key of type " + str(type(key)) + " has been found. It will be converted to type str, but this will cause all sorts of problems on deshelve. Please bring this to the attention of the " + application.name + " developers immediately. More information about the error will be written to the error log.",True)
        log.error("Uh oh, " + str(key) + " is of type " + str(type(key)) + "!")
    # Convert unicode objects to UTF-8 strings before shelve these objects.
    if type(value) == list and self.settings["general"]["persist_size"] != -1 and len(value) > self.settings["general"]["persist_size"]:
        shelf[str(key.encode("utf-8"))]=value[self.settings["general"]["persist_size"]:]
    else:
        shelf[str(key.encode("utf-8"))]=value
   shelf.close()
  except:
   output.speak("An exception occurred while shelving the " + application.name + " database. It will be deleted and rebuilt automatically. If this error persists, send the error log to the " + application.name + " developers.",True)
   log.exception("Exception while shelving" + shelfname)
   os.remove(shelfname)
コード例 #6
0
 def fill_list(self):
     sessionsList = []
     log.debug("Filling the sessions list.")
     self.sessions = []
     for i in os.listdir(paths.config_path()):
         if os.path.isdir(paths.config_path(i)):
             log.debug("Adding session %s" % (i, ))
             strconfig = "%s/session.conf" % (paths.config_path(i))
             config_test = config_utils.load_config(strconfig)
             name = config_test["twitter"]["user_name"]
             if config_test["twitter"]["user_key"] != "" and config_test[
                     "twitter"]["user_secret"] != "":
                 sessionsList.append(name)
                 self.sessions.append(i)
             else:
                 try:
                     log.debug("Deleting session %s" % (i, ))
                     shutil.rmtree(paths.config_path(i))
                 except:
                     output.speak(
                         "An exception was raised while attempting to clean malformed session data. See the error log for details. If this message persists, contact the developers.",
                         True)
                     os.exception(
                         "Exception thrown while removing malformed session"
                     )
     self.view.fill_list(sessionsList)
コード例 #7
0
def setup():
    global app
    log.debug("Loading global app settings...")
    app = config_utils.load_config(paths.config_path(MAINFILE),
                                   paths.app_path(MAINSPEC))
    log.debug("Loading keymap...")
    global keymap
    keymap = config_utils.load_config(
        paths.config_path("keymap.keymap"),
        paths.app_path("keymaps/" + app['app-settings']['load_keymap']))
コード例 #8
0
	def manage_new_account(self, *args, **kwargs):
		if self.view.new_account_dialog() == widgetUtils.YES:
			location = (str(time.time())[-6:])
			log.debug("Creating session in the %s path" % (location,))
			s = session.vkSession(location)
			path = paths.config_path(location)
			if not os.path.exists(path):
				log.debug("Creating %s path" % (paths.config_path(path),))
				os.mkdir(path)
			s.get_configuration()
			self.get_authorisation(s)
			self.sessions.append(location)
			self.view.add_new_session_to_list()
コード例 #9
0
	def fill_list(self):
		sessionsList = []
		log.debug("Filling the sessions list.")
		self.sessions = []
		for i in os.listdir(paths.config_path()):
			if os.path.isdir(paths.config_path(i)):
				log.debug("Adding session %s" % (i,))
				strconfig = "%s/session.conf" % (paths.config_path(i))
				config_test = Configuration(strconfig)
				name = config_test["vk"]["user"]
				sessionsList.append(name)
				self.sessions.append(i)
		self.view.fill_list(sessionsList)
コード例 #10
0
	def fill_list(self):
		log.debug("Filling the session list...")
		for i in os.listdir(paths.config_path()):
			if os.path.isdir(paths.config_path(i)):
				log.debug("Adding session %s" % (i,))
				strconfig = "%s/session.conf" % (paths.config_path(i))
				config_test = Configuration(strconfig)
				name = config_test["vk"]["user"]
				if name != "" and config_test["vk"]["password"] != "":
					self.session = i
					s = session.vkSession(self.session)
					s.get_configuration()
					session.sessions[self.session] = s
コード例 #11
0
	def manage_new_account(self):
		if view.new_account_dialog() == widgetUtils.YES:
			location = (str(time.time())[-6:])
			log.debug("Creating session in the %s path" % (location,))
			s = session.vkSession(location)
			path = paths.config_path(location)
			if not os.path.exists(path):
				log.debug("Creating %s path" % (paths.config_path(path),))
				os.mkdir(path)
			s.get_configuration()
			self.get_authorisation(s)
			session.sessions[location] = s
		else:
			sys.exit()
コード例 #12
0
ファイル: manager.py プロジェクト: Oire/TWBlue
 def __init__(self):
  FILE = "sessions.conf"
  SPEC = "sessions.defaults"
  try:
   self.main = Configuration(paths.config_path(FILE), paths.app_path(SPEC))
  except ConfigurationResetException:
   pass
コード例 #13
0
def setup():
    log.debug("Starting " + application.name + " %s" % (application.version, ))
    config.setup()
    fixes.setup()
    log.debug("Using %s %s" % (platform.system(), platform.architecture()[0]))
    log.debug("Application path is %s" % (paths.app_path(), ))
    log.debug("config path  is %s" % (paths.config_path(), ))
    sound.setup()
    output.setup()
    languageHandler.setLanguage(config.app["app-settings"]["language"])
    keys.setup()
    from controller import mainController
    from sessionmanager import sessionManager
    app = widgetUtils.mainLoopObject()
    if system == "Windows":
        if config.app["app-settings"]["donation_dialog_displayed"] == False:
            donation()
        updater.do_update()
    sm = sessionManager.sessionManagerController()
    sm.fill_list()
    if len(sm.sessions) == 0: sm.show()
    else:
        sm.do_ok()
    if hasattr(sm.view, "destroy"):
        sm.view.destroy()
    del sm
    r = mainController.Controller()
    r.view.show()
    r.do_work()
    r.check_invisible_at_startup()
    if system == "Windows":
        call_threaded(r.start)
    elif system == "Linux":
        GLib.idle_add(r.start)
    app.run()
コード例 #14
0
ファイル: config.py プロジェクト: Oire/TWBlue
def setup ():
 global main
 try:
  main = Configuration(paths.config_path(MAINFILE), paths.app_path(MAINSPEC))
 except ConfigurationResetException:
  pass
# return main
コード例 #15
0
	def remove(self, *args, **kwargs):
		if self.view.remove_account_dialog() == widgetUtils.YES:
			selected_account = self.sessions[self.view.get_selected()]
			self.view.remove_session(self.view.get_selected())
			self.removed_sessions.append(selected_account)
			self.sessions.remove(selected_account)
			shutil.rmtree(path=paths.config_path(selected_account), ignore_errors=True)
コード例 #16
0
ファイル: settings.py プロジェクト: codeofdusk/ProjectMagenta
 def save_configuration(self):
  if self.codes[self.dialog.general.language.GetSelection()] != config.app["app-settings"]["language"]:
   config.app["app-settings"]["language"] = self.codes[self.dialog.general.language.GetSelection()]
   languageHandler.setLanguage(config.app["app-settings"]["language"])
   self.needs_restart = True
  if self.kmnames[self.dialog.general.km.GetSelection()] != config.app["app-settings"]["load_keymap"]:
   config.app["app-settings"]["load_keymap"] =self.kmnames[self.dialog.general.km.GetSelection()]
   kmFile = open(paths.config_path("keymap.keymap"), "w")
   kmFile.close()
   self.needs_restart = True

  if config.app["app-settings"]["use_invisible_keyboard_shorcuts"] != self.dialog.get_value("general", "use_invisible_shorcuts"):
   config.app["app-settings"]["use_invisible_keyboard_shorcuts"] = self.dialog.get_value("general", "use_invisible_shorcuts")
   pub.sendMessage("invisible-shorcuts-changed", registered=self.dialog.get_value("general", "use_invisible_shorcuts"))
  config.app["app-settings"]["voice_enabled"] = self.dialog.get_value("general", "disable_sapi5")
  config.app["app-settings"]["hide_gui"] = self.dialog.get_value("general", "hide_gui")
  config.app["app-settings"]["ask_at_exit"] = self.dialog.get_value("general", "ask_at_exit")
  config.app["app-settings"]["handle_longtweets"] = self.dialog.get_value("general", "handle_longtweets")
  config.app["app-settings"]["play_ready_sound"] = self.dialog.get_value("general", "play_ready_sound")
  config.app["app-settings"]["speak_ready_msg"] = self.dialog.get_value("general", "speak_ready_msg")
  if config.app["proxy"]["server"] != self.dialog.get_value("proxy", "server") or config.app["proxy"]["port"] != self.dialog.get_value("proxy", "port") or config.app["proxy"]["user"] != self.dialog.get_value("proxy", "user") or config.app["proxy"]["password"] != self.dialog.get_value("proxy", "password"):
   if self.is_started == True:
    self.needs_restart = True
   config.app["proxy"]["server"] = self.dialog.get_value("proxy", "server")
   config.app["proxy"]["port"] = self.dialog.get_value("proxy", "port")
   config.app["proxy"]["user"] = self.dialog.get_value("proxy", "user")
   config.app["proxy"]["password"] = self.dialog.get_value("proxy", "password")
  config.app.write()
コード例 #17
0
ファイル: manager.py プロジェクト: Oire/TWBlue
 def is_valid(self, id):
  if not os.path.exists(paths.config_path(id)):
   raise session_exceptions.NonExistentSessionError("That session does not exist.")
   self.main["sessions"]["current_session"] = ""
   return False
  else:
   return True
コード例 #18
0
 def __init__(self):
     self.connection = sqlite3.connect(
         paths.config_path("%s/autocompletionUsers.dat" %
                           (manager.manager.get_current_session())))
     self.cursor = self.connection.cursor()
     if self.table_exist("users") == False:
         self.create_table()
コード例 #19
0
 def is_valid(self, id):
     if not os.path.exists(paths.config_path(id)):
         raise session_exceptions.NonExistentSessionError(
             "That session does not exist.")
         config.app["sessions"]["current_session"] = ""
         return False
     else:
         return True
コード例 #20
0
ファイル: gui.py プロジェクト: Oire/TWBlue
 def remove(self, ev):
  selected_item = self.list.get_selected()
  selected_session = self.sessions[selected_item]
  ask = wx.MessageDialog(self, _(u"Do you really want delete this account?"), _(u"Remove account"), wx.YES_NO)
  if ask.ShowModal() == wx.ID_YES:
   self.sessions.remove(selected_session)
   shutil.rmtree(path=paths.config_path(selected_session), ignore_errors=True)
   self.list.remove_item(selected_item)
コード例 #21
0
ファイル: gui.py プロジェクト: Oire/TWBlue
 def fill_list(self):
  self.sessions = []
  for i in os.listdir(paths.config_path()):
   if os.path.isdir(paths.config_path(i)):
    strconfig = "%s/session.conf" % (paths.config_path(i))
    config_test = Configuration(strconfig)
    name = config_test["twitter"]["user_name"]
    if name != "" or (config_test["twitter"]["user_key"] != "" and config_test["twitter"]["user_secret"] != ""):
     self.list.insert_item(False, name)
     self.sessions.append(i)
    else:
     del config_test
     shutil.rmtree(path=paths.config_path(i), ignore_errors=True)
  if self.list.get_count() > 0:
   self.list.select_item(0)
  self.list.list.SetSize(self.list.list.GetBestSize())
  self.removeSession.Enable()
コード例 #22
0
ファイル: session.py プロジェクト: py-driven8250/socializer
	def get_configuration(self):

		""" Gets settings for a session."""
 
		file_ = "%s/session.conf" % (self.session_id,)
#  try:
		log.debug("Creating config file %s" % (file_,))
		self.settings = Configuration(paths.config_path(file_), paths.app_path("session.defaults"))
コード例 #23
0
 def remove(self, *args, **kwargs):
     if self.view.remove_account_dialog() == widgetUtils.YES:
         selected_account = self.sessions[self.view.get_selected()]
         self.view.remove_session(self.view.get_selected())
         self.removed_sessions.append(selected_account)
         self.sessions.remove(selected_account)
         shutil.rmtree(path=paths.config_path(selected_account),
                       ignore_errors=True)
コード例 #24
0
 def __init__(self):
     FILE = "sessions.conf"
     SPEC = "sessions.defaults"
     try:
         self.main = Configuration(paths.config_path(FILE),
                                   paths.app_path(SPEC))
     except ConfigurationResetException:
         pass
コード例 #25
0
    def save_configuration(self):
        if self.codes[self.dialog.general.language.GetSelection(
        )] != config.app["app-settings"]["language"]:
            config.app["app-settings"]["language"] = self.codes[
                self.dialog.general.language.GetSelection()]
            languageHandler.setLanguage(config.app["app-settings"]["language"])
            self.needs_restart = True
        if self.kmnames[self.dialog.general.km.GetSelection(
        )] != config.app["app-settings"]["load_keymap"]:
            config.app["app-settings"]["load_keymap"] = self.kmnames[
                self.dialog.general.km.GetSelection()]
            kmFile = open(paths.config_path("keymap.keymap"), "w")
            kmFile.close()
            self.needs_restart = True

        if config.app["app-settings"][
                "use_invisible_keyboard_shorcuts"] != self.dialog.get_value(
                    "general", "use_invisible_shorcuts"):
            config.app["app-settings"][
                "use_invisible_keyboard_shorcuts"] = self.dialog.get_value(
                    "general", "use_invisible_shorcuts")
            pub.sendMessage("invisible-shorcuts-changed",
                            registered=self.dialog.get_value(
                                "general", "use_invisible_shorcuts"))
        config.app["app-settings"]["voice_enabled"] = self.dialog.get_value(
            "general", "disable_sapi5")
        config.app["app-settings"]["hide_gui"] = self.dialog.get_value(
            "general", "hide_gui")
        config.app["app-settings"]["ask_at_exit"] = self.dialog.get_value(
            "general", "ask_at_exit")
        config.app["app-settings"][
            "handle_longtweets"] = self.dialog.get_value(
                "general", "handle_longtweets")
        config.app["app-settings"]["play_ready_sound"] = self.dialog.get_value(
            "general", "play_ready_sound")
        config.app["app-settings"]["speak_ready_msg"] = self.dialog.get_value(
            "general", "speak_ready_msg")
        if config.app["proxy"]["server"] != self.dialog.get_value(
                "proxy", "server"
        ) or config.app["proxy"]["port"] != self.dialog.get_value(
                "proxy", "port"
        ) or config.app["proxy"]["user"] != self.dialog.get_value(
                "proxy", "user"
        ) or config.app["proxy"]["password"] != self.dialog.get_value(
                "proxy", "password"):
            if self.is_started == True:
                self.needs_restart = True
            config.app["proxy"]["server"] = self.dialog.get_value(
                "proxy", "server")
            config.app["proxy"]["port"] = self.dialog.get_value(
                "proxy", "port")
            config.app["proxy"]["user"] = self.dialog.get_value(
                "proxy", "user")
            config.app["proxy"]["password"] = self.dialog.get_value(
                "proxy", "password")
        config.app.write()
コード例 #26
0
ファイル: config.py プロジェクト: zywek123/TWBlue
def setup():
    global main
    try:
        main = Configuration(paths.config_path(MAINFILE),
                             paths.app_path(MAINSPEC))
    except ConfigurationResetException:
        pass


# return main
コード例 #27
0
ファイル: gui.py プロジェクト: zywek123/TWBlue
 def fill_list(self):
     self.sessions = []
     for i in os.listdir(paths.config_path()):
         if os.path.isdir(paths.config_path(i)):
             strconfig = "%s/session.conf" % (paths.config_path(i))
             config_test = Configuration(strconfig)
             name = config_test["twitter"]["user_name"]
             if name != "" or (config_test["twitter"]["user_key"] != "" and
                               config_test["twitter"]["user_secret"] != ""):
                 self.list.insert_item(False, name)
                 self.sessions.append(i)
             else:
                 del config_test
                 shutil.rmtree(path=paths.config_path(i),
                               ignore_errors=True)
     if self.list.get_count() > 0:
         self.list.select_item(0)
     self.list.list.SetSize(self.list.list.GetBestSize())
     self.removeSession.Enable()
コード例 #28
0
ファイル: session.py プロジェクト: TWBlueQS/TWBlueQS
 def deshelve(self):
  "Import a shelved database."
  shelfname=paths.config_path(str(self.session_id)+"/cache.db")
  if self.settings["general"]["persist_size"] == 0:
   if os.path.exists(shelfname):
    os.remove(shelfname)
   return
  try:
   shelf=shelve.open(paths.config_path(shelfname),'c')
   for key,value in shelf.items():
    self.db[key]=value
   shelf.close()
  except:
   output.speak("An exception occurred while deshelving the " + application.name + " database. It will be deleted and rebuilt automatically. If this error persists, send the error log to the " + application.name + " developers.",True)
   log.exception("Exception while deshelving" + shelfname)
   try: 
    os.remove(shelfname)
   except:
    pass
コード例 #29
0
 def get_configuration(self):

   """ Gets settings for a session."""
 
   file_ = "%s/session.conf" % (self.session_id,)
#  try:
   log.debug("Creating config file %s" % (file_,))
   self.settings = config_utils.load_config(paths.config_path(file_), paths.app_path("Conf.defaults"))
   self.init_sound()
   self.deshelve()
コード例 #30
0
ファイル: session.py プロジェクト: TWBlueQS/TWBlueQS
 def get_configuration(self):

   """ Gets settings for a session."""
 
   file_ = "%s/session.conf" % (self.session_id,)
#  try:
   log.debug("Creating config file %s" % (file_,))
   self.settings = config_utils.load_config(paths.config_path(file_), paths.app_path("Conf.defaults"))
   self.init_sound()
   self.deshelve()
コード例 #31
0
 def deshelve(self):
  "Import a shelved database."
  shelfname=paths.config_path(str(self.session_id)+"/cache.db")
  if self.settings["general"]["persist_size"] == 0:
   if os.path.exists(shelfname):
    os.remove(shelfname)
   return
  try:
   shelf=shelve.open(paths.config_path(shelfname),'c')
   for key,value in shelf.items():
    self.db[key]=value
   shelf.close()
  except:
   output.speak("An exception occurred while deshelving the " + application.name + " database. It will be deleted and rebuilt automatically. If this error persists, send the error log to the " + application.name + " developers.",True)
   log.exception("Exception while deshelving" + shelfname)
   try: 
    os.remove(shelfname)
   except:
    pass
コード例 #32
0
ファイル: gui.py プロジェクト: zywek123/TWBlue
 def remove(self, ev):
     selected_item = self.list.get_selected()
     selected_session = self.sessions[selected_item]
     ask = wx.MessageDialog(self,
                            _(u"Do you really want delete this account?"),
                            _(u"Remove account"), wx.YES_NO)
     if ask.ShowModal() == wx.ID_YES:
         self.sessions.remove(selected_session)
         shutil.rmtree(path=paths.config_path(selected_session),
                       ignore_errors=True)
         self.list.remove_item(selected_item)
コード例 #33
0
 def fill_list(self):
  sessionsList = []
  log.debug("Filling the sessions list.")
  self.sessions = []
  for i in os.listdir(paths.config_path()):
   if os.path.isdir(paths.config_path(i)):
    log.debug("Adding session %s" % (i,))
    strconfig = "%s/session.conf" % (paths.config_path(i))
    config_test = config_utils.load_config(strconfig)
    name = config_test["twitter"]["user_name"]
    if config_test["twitter"]["user_key"] != "" and config_test["twitter"]["user_secret"] != "":
     sessionsList.append(name)
     self.sessions.append(i)
    else:
     try:
      log.debug("Deleting session %s" % (i,))
      shutil.rmtree(paths.config_path(i))
     except:
      output.speak("An exception was raised while attempting to clean malformed session data. See the error log for details. If this message persists, contact the developers.",True)
      os.exception("Exception thrown while removing malformed session")
  self.view.fill_list(sessionsList)
コード例 #34
0
ファイル: main.py プロジェクト: TWBlueQS/TWBlueQS
def setup():
    log.debug("Starting " + application.name + " %s" % (application.version,))
    config.setup()
    log.debug("Using %s %s" % (platform.system(), platform.architecture()[0]))
    log.debug("Application path is %s" % (paths.app_path(),))
    log.debug("config path  is %s" % (paths.config_path(),))
    sound.setup()
    output.setup()
    languageHandler.setLanguage(config.app["app-settings"]["language"])
    message(message=_(u"Loading files and configuration, please wait..."))
    fixes.setup()
    keys.setup()
    from controller import mainController
    from sessionmanager import sessionManager

    app = widgetUtils.mainLoopObject()
    gplwarning()

    if system == "Windows":
        if config.app["app-settings"]["donation_dialog_displayed"] == False:
            donation()
        if config.app["app-settings"]["check_updates"] == True:
            updater.do_update()
        else:
            message(message=_(u"Set to ignore updates at startup. To change this preference, go to global config"))
    sm = sessionManager.sessionManagerController()
    sm.fill_list()
    if len(sm.sessions) == 0:
        sm.show()
    else:
        sm.do_ok()
    if hasattr(sm.view, "destroy"):
        sm.view.destroy()
    del sm
    r = mainController.Controller()
    r.view.show()
    r.do_work()
    r.check_invisible_at_startup()
    if system == "Windows":
        call_threaded(r.start)
    elif system == "Linux":
        GLib.idle_add(r.start)
    message(
        message=_(u"Welcome to %s. Main application's window will appears shortly. Happy tweeting!") % application.name
    )
    app.run()
コード例 #35
0
ファイル: main.py プロジェクト: manuelcortez/socializer
def setup():
	log.debug("Starting Socializer %s" % (application.version,))
	config.setup()
	log.debug("Using %s %s" % (platform.system(), platform.architecture()[0]))
	log.debug("Application path is %s" % (paths.app_path(),))
	log.debug("config path  is %s" % (paths.config_path(),))
	output.setup()
	languageHandler.setLanguage(config.app["app-settings"]["language"])
	log.debug("Language set to %s" % (languageHandler.getLanguage()))
	keys.setup()
	from controller import mainController
	from sessionmanager import sessionManager
	app = widgetUtils.mainLoopObject()
	log.debug("Created Application mainloop object")
	sm = sessionManager.sessionManagerController()
	del sm
	r = mainController.Controller()
	call_threaded(r.login)
	app.run()
コード例 #36
0
    sys.stderr = open(paths.logs_path("stderr.log"), 'w')
    sys.stdout = open(paths.logs_path("stdout.log"), 'w')
else:
    sys.stdout = stdout
    sys.stderr = stderr
#the final log files have been opened succesfully, let's close the temporal files
stdout_temp.close()
stderr_temp.close()
#finally, remove the temporal files. TW Blue doesn't need them anymore, and we will get more free space on the harddrive
os.remove(stdout_temp.name)
os.remove(stderr_temp.name)
app = wx.App()
#app = wx.App(redirect=True, useBestVisual=True, filename=paths.logs_path('tracebacks.log'))
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:
    frame = gui.main.mainFrame()
コード例 #37
0
ファイル: storage.py プロジェクト: TWBlueQS/TWBlueQS
 def __init__(self, session_id):
  self.connection = sqlite3.connect(paths.config_path("%s/autocompletionUsers.dat" % (session_id)))
  self.cursor = self.connection.cursor()
  if self.table_exist("users") == False:
   self.create_table()
コード例 #38
0
ファイル: config.py プロジェクト: manuelcortez/socializer
def setup ():
 global app
 log.debug("Loading global app settings...")
 app = config_utils.load_config(paths.config_path(MAINFILE), paths.app_path(MAINSPEC))
 
コード例 #39
0
 def add_session(self, id):
     path = paths.config_path(id)
     if not os.path.exists(path):
         os.mkdir(path)
         self.main["sessions"]["sessions"].append(id)
コード例 #40
0
 def __init__(self, session_id):
     self.connection = sqlite3.connect(
         paths.config_path("%s/autocompletionUsers.dat" % (session_id)))
     self.cursor = self.connection.cursor()
     if self.table_exist("users") == False:
         self.create_table()
コード例 #41
0
ファイル: storage.py プロジェクト: Oire/TWBlue
 def __init__(self):
  self.connection = sqlite3.connect(paths.config_path("%s/autocompletionUsers.dat" % (manager.manager.get_current_session())))
  self.cursor = self.connection.cursor()
  if self.table_exist("users") == False:
   self.create_table()
コード例 #42
0
ファイル: main.py プロジェクト: Oire/TWBlue
 sys.stderr = open(paths.logs_path("stderr.log"), 'w')
 sys.stdout = open(paths.logs_path("stdout.log"), 'w')
else:
 sys.stdout=stdout
 sys.stderr=stderr
#the final log files have been opened succesfully, let's close the temporal files
stdout_temp.close()
stderr_temp.close()
#finally, remove the temporal files. TW Blue doesn't need them anymore, and we will get more free space on the harddrive
os.remove(stdout_temp.name)
os.remove(stderr_temp.name)
app = wx.App()
#app = wx.App(redirect=True, useBestVisual=True, filename=paths.logs_path('tracebacks.log'))
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:
 frame = gui.main.mainFrame()
 frame.Show()
コード例 #43
0
ファイル: manager.py プロジェクト: Oire/TWBlue
 def add_session(self, id):
  path = paths.config_path(id)
  if not os.path.exists(path):
   os.mkdir(path)
   self.main["sessions"]["sessions"].append(id)