diff options
author | Zeljko Ametovic <amet1977@gmail.com> | 2011-07-01 23:51:49 -0700 |
---|---|---|
committer | Zeljko Ametovic <amet1977@gmail.com> | 2011-07-01 23:51:49 -0700 |
commit | 9d8f298e9b539c814de58cc684cbfc6acadafade (patch) | |
tree | a36b0a50c95ede5353827a0943d9773f005f1ff0 | |
parent | 2abdd356ac115964184ac0ca12b424742ce8fc08 (diff) | |
parent | 3ebb5c1e4321a53f5c52cc9e378af36cf0856c9d (diff) |
Merge pull request #241 from amet/python_cleanup
Python cleanup
-rw-r--r-- | xbmc/ApplicationMessenger.cpp | 8 | ||||
-rw-r--r-- | xbmc/ApplicationMessenger.h | 2 | ||||
-rw-r--r-- | xbmc/interfaces/python/XBPython.cpp | 6 | ||||
-rw-r--r-- | xbmc/interfaces/python/xbmcmodule/xbmcmodule.cpp | 76 |
4 files changed, 16 insertions, 76 deletions
diff --git a/xbmc/ApplicationMessenger.cpp b/xbmc/ApplicationMessenger.cpp index c56f52e98f..0480e9079e 100644 --- a/xbmc/ApplicationMessenger.cpp +++ b/xbmc/ApplicationMessenger.cpp @@ -489,7 +489,7 @@ case TMSG_POWERDOWN: break; case 3: - g_application.getApplicationMessenger().RebootToDashBoard(); + g_application.getApplicationMessenger().Quit(); break; case 4: @@ -1019,12 +1019,6 @@ void CApplicationMessenger::RestartApp() SendMessage(tMsg); } -void CApplicationMessenger::RebootToDashBoard() -{ - ThreadMessage tMsg = {TMSG_DASHBOARD}; - SendMessage(tMsg); -} - void CApplicationMessenger::NetworkMessage(DWORD dwMessage, DWORD dwParam) { ThreadMessage tMsg = {TMSG_NETWORKMESSAGE, dwMessage, dwParam}; diff --git a/xbmc/ApplicationMessenger.h b/xbmc/ApplicationMessenger.h index 17a3629deb..772303018d 100644 --- a/xbmc/ApplicationMessenger.h +++ b/xbmc/ApplicationMessenger.h @@ -64,7 +64,6 @@ class CGUIDialog; #define TMSG_SHUTDOWN 300 #define TMSG_POWERDOWN 301 #define TMSG_QUIT 302 -#define TMSG_DASHBOARD TMSG_QUIT #define TMSG_HIBERNATE 303 #define TMSG_SUSPEND 304 #define TMSG_RESTART 305 @@ -167,7 +166,6 @@ public: void Hibernate(); void Suspend(); void Restart(); - void RebootToDashBoard(); void RestartApp(); void Reset(); void SwitchToFullscreen(); // diff --git a/xbmc/interfaces/python/XBPython.cpp b/xbmc/interfaces/python/XBPython.cpp index f9dfe9f8d1..4995b94403 100644 --- a/xbmc/interfaces/python/XBPython.cpp +++ b/xbmc/interfaces/python/XBPython.cpp @@ -236,11 +236,11 @@ void XBPython::UnloadExtensionLibs() "\tdef __init__(self, loglevel=xbmc.LOGNOTICE):\n" \ "\t\tself.ll=loglevel\n" \ "\tdef write(self, data):\n" \ - "\t\txbmc.output(data,self.ll)\n" \ + "\t\txbmc.log(data,self.ll)\n" \ "\tdef close(self):\n" \ - "\t\txbmc.output('.')\n" \ + "\t\txbmc.log('.')\n" \ "\tdef flush(self):\n" \ - "\t\txbmc.output('.')\n" \ + "\t\txbmc.log('.')\n" \ "import sys\n" \ "sys.stdout = xbmcout()\n" \ "sys.stderr = xbmcout(xbmc.LOGERROR)\n" diff --git a/xbmc/interfaces/python/xbmcmodule/xbmcmodule.cpp b/xbmc/interfaces/python/xbmcmodule/xbmcmodule.cpp index 1047fdb989..52c6b1d155 100644 --- a/xbmc/interfaces/python/xbmcmodule/xbmcmodule.cpp +++ b/xbmc/interfaces/python/xbmcmodule/xbmcmodule.cpp @@ -52,6 +52,7 @@ #include "guilib/LocalizeStrings.h" #include "utils/FileUtils.h" #include "pythreadstate.h" +#include "utils/log.h" // include for constants #include "pyutil.h" @@ -75,53 +76,6 @@ namespace PYXBMC * start of xbmc methods *****************************************************************/ - // output() method - PyDoc_STRVAR(output__doc__, - "output(msg[, level]) -- Write a string to XBMC's log file and the debug window.\n" - "\n" - "msg : string - text to output.\n" - "level : [opt] integer - log level to ouput at. (default=LOGNOTICE)\n" - "\n" - "*Note, You can use the above as keywords for arguments and skip certain optional arguments.\n" - " Once you use a keyword, all following arguments require the keyword.\n" - "\n" - " Text is written to the log for the following conditions.\n" - " XBMC loglevel == -1 (NONE, nothing at all is logged)" - " XBMC loglevel == 0 (NORMAL, shows LOGNOTICE, LOGERROR, LOGSEVERE and LOGFATAL)" - " XBMC loglevel == 1 (DEBUG, shows all)" - " See pydocs for valid values for level.\n" - "\n" - "example:\n" - " - xbmc.output(msg='This is a test string.', level=xbmc.LOGDEBUG)\n"); - - PyObject* XBMC_Output(PyObject *self, PyObject *args, PyObject *kwds) - { - static const char *keywords[] = { - "msg", - "level", - NULL}; - - char *s_line = NULL; - int iLevel = LOGNOTICE; - if (!PyArg_ParseTupleAndKeywords( - args, - kwds, - (char*)"s|i", - (char**)keywords, - &s_line, - &iLevel)) - { - return NULL; - } - // check for a valid loglevel - if (iLevel < LOGDEBUG || iLevel > LOGNONE) - iLevel = LOGNOTICE; - CLog::Log(iLevel, "%s", s_line); - - Py_INCREF(Py_None); - return Py_None; - } - // log() method PyDoc_STRVAR(log__doc__, "log(msg[, level]) -- Write a string to XBMC's log file.\n" @@ -170,6 +124,17 @@ namespace PYXBMC return Py_None; } + // output() method + PyDoc_STRVAR(output__doc__, + "'xbmc.output()' is depreciated and will be removed in future releases,\n" + "please use 'xbmc.log()' instead"); + + PyObject* XBMC_Output(PyObject *self, PyObject *args, PyObject *kwds) + { + CLog::Log(LOGWARNING,"'xbmc.output()' is depreciated and will be removed in future releases, please use 'xbmc.log()' instead"); + return XBMC_Log(self, args, kwds); + } + // shutdown() method PyDoc_STRVAR(shutdown__doc__, "shutdown() -- Shutdown the xbox.\n" @@ -186,22 +151,6 @@ namespace PYXBMC return Py_None; } - // dashboard() method - PyDoc_STRVAR(dashboard__doc__, - "dashboard() -- Boot to dashboard as set in My Pograms/General.\n" - "\n" - "example:\n" - " - xbmc.dashboard()\n"); - - PyObject* XBMC_Dashboard(PyObject *self, PyObject *args) - { - ThreadMessage tMsg = {TMSG_DASHBOARD}; - g_application.getApplicationMessenger().SendMessage(tMsg); - - Py_INCREF(Py_None); - return Py_None; - } - // restart() method PyDoc_STRVAR(restart__doc__, "restart() -- Restart the xbox.\n" @@ -982,7 +931,6 @@ namespace PYXBMC {(char*)"sleep", (PyCFunction)XBMC_Sleep, METH_VARARGS, sleep__doc__}, {(char*)"shutdown", (PyCFunction)XBMC_Shutdown, METH_VARARGS, shutdown__doc__}, - {(char*)"dashboard", (PyCFunction)XBMC_Dashboard, METH_VARARGS, dashboard__doc__}, {(char*)"restart", (PyCFunction)XBMC_Restart, METH_VARARGS, restart__doc__}, {(char*)"getSkinDir", (PyCFunction)XBMC_GetSkinDir, METH_VARARGS, getSkinDir__doc__}, {(char*)"getLocalizedString", (PyCFunction)XBMC_GetLocalizedString, METH_VARARGS, getLocalizedString__doc__}, |