Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: xbmc/lib/libPython/xbmcmodule/xbmcguimodule.cpp
- ===================================================================
- --- xbmc/lib/libPython/xbmcmodule/xbmcguimodule.cpp (revision 20410)
- +++ xbmc/lib/libPython/xbmcmodule/xbmcguimodule.cpp (working copy)
- @@ -228,8 +228,8 @@
- PyModule_AddObject(pXbmcGuiModule, (char*)"WindowXML", (PyObject*)&WindowXML_Type);
- PyModule_AddObject(pXbmcGuiModule, (char*)"WindowXMLDialog", (PyObject*)&WindowXMLDialog_Type);
- PyModule_AddObject(pXbmcGuiModule, (char*)"ListItem", (PyObject*)&ListItem_Type);
- - //PyModule_AddObject(pXbmcGuiModule, (char*)"Control", (PyObject*)&Control_Type);
- - //PyModule_AddObject(pXbmcGuiModule, (char*)"ControlSpin", (PyObject*)&ControlSpin_Type);
- + PyModule_AddObject(pXbmcGuiModule, (char*)"Control", (PyObject*)&Control_Type);
- + PyModule_AddObject(pXbmcGuiModule, (char*)"ControlSpin", (PyObject*)&ControlSpin_Type);
- PyModule_AddObject(pXbmcGuiModule, (char*)"ControlLabel", (PyObject*)&ControlLabel_Type);
- PyModule_AddObject(pXbmcGuiModule, (char*)"ControlFadeLabel", (PyObject*)&ControlFadeLabel_Type);
- PyModule_AddObject(pXbmcGuiModule, (char*)"ControlTextBox", (PyObject*)&ControlTextBox_Type);
- Index: xbmc/lib/libPython/xbmcmodule/window.cpp
- ===================================================================
- --- xbmc/lib/libPython/xbmcmodule/window.cpp (revision 20410)
- +++ xbmc/lib/libPython/xbmcmodule/window.cpp (working copy)
- @@ -602,6 +602,10 @@
- else if (ControlRadioButton_Check(pControl))
- ControlRadioButton_Create((ControlRadioButton*)pControl);
- + // Control SpinControl
- + else if (ControlSpin_Check(pControl))
- + ControlSpin_Create((ControlSpin*)pControl);
- +
- //unknown control type to add, should not happen
- else
- {
- Index: xbmc/lib/libPython/xbmcmodule/GUIPythonWindow.cpp
- ===================================================================
- --- xbmc/lib/libPython/xbmcmodule/GUIPythonWindow.cpp (revision 20410)
- +++ xbmc/lib/libPython/xbmcmodule/GUIPythonWindow.cpp (working copy)
- @@ -122,6 +122,7 @@
- // currently we only accept messages from a button or controllist with a select action
- if ((ControlList_CheckExact(inf->pObject) && (message.GetParam1() == ACTION_SELECT_ITEM || message.GetParam1() == ACTION_MOUSE_LEFT_CLICK)) ||
- ControlButton_CheckExact(inf->pObject) || ControlRadioButton_CheckExact(inf->pObject) ||
- + ControlSpin_CheckExact(inf->pObject) ||
- ControlCheckMark_CheckExact(inf->pObject))
- {
- // create a new call and set it in the python queue
- Index: xbmc/lib/libPython/xbmcmodule/control.h
- ===================================================================
- --- xbmc/lib/libPython/xbmcmodule/control.h (revision 20410)
- +++ xbmc/lib/libPython/xbmcmodule/control.h (working copy)
- @@ -248,6 +248,7 @@
- CGUIControl* ControlList_Create(ControlList* pControl);
- CGUIControl* ControlProgress_Create(ControlProgress* pControl);
- CGUIControl* ControlRadioButton_Create(ControlRadioButton* pControl);
- + CGUIControl* ControlSpin_Create(ControlSpin* pControl);
- void initControl_Type();
- void initControlSpin_Type();
- Index: xbmc/lib/libPython/xbmcmodule/controltextbox.cpp
- ===================================================================
- --- xbmc/lib/libPython/xbmcmodule/controltextbox.cpp (revision 20410)
- +++ xbmc/lib/libPython/xbmcmodule/controltextbox.cpp (working copy)
- @@ -107,6 +107,33 @@
- return pControl->pGUIControl;
- }
- +
- + // SetPageControl() Method
- + PyDoc_STRVAR(SetPageControl__doc__,
- + "setPageControl(id) -- Sets the page control for this textbox.\n"
- + "\n"
- + "id : integer - id of the Page Control.\n"
- + "\n"
- + "example:\n"
- + " - self.textbox.setPageControl(10)");
- +
- + PyObject* ControlTextBox_SetPageControl(ControlTextBox *self, PyObject *args)
- + {
- + CLog::Log(LOGNOTICE, "SetPage Control invoked");
- + PyObject *pObjectText;
- + int pageControlId = -1;
- + if (!PyArg_ParseTuple(args, (char*)"l", &pageControlId)) return NULL;
- + CLog::Log(LOGNOTICE, "SetPage Control Parsed %d", pageControlId);
- +
- + ControlTextBox *pControl = (ControlTextBox*)self;
- + PyGUILock();
- + static_cast<CGUITextBox*>(pControl->pGUIControl)->SetPageControl(pageControlId);
- + PyGUIUnlock();
- + CLog::Log(LOGNOTICE, "SetPage Control finished");
- +
- + return Py_None;
- + }
- +
- // SetText() Method
- PyDoc_STRVAR(setText__doc__,
- "setText(text) -- Set's the text for this textbox.\n"
- @@ -163,6 +190,7 @@
- PyMethodDef ControlTextBox_methods[] = {
- {(char*)"setText", (PyCFunction)ControlTextBox_SetText, METH_VARARGS, setText__doc__},
- {(char*)"reset", (PyCFunction)ControlTextBox_Reset, METH_VARARGS, reset__doc__},
- + {(char*)"setPageControl",(PyCFunction)ControlTextBox_SetPageControl, METH_VARARGS, SetPageControl__doc__},
- {NULL, NULL, 0, NULL}
- };
- Index: xbmc/lib/libPython/xbmcmodule/controlspin.cpp
- ===================================================================
- --- xbmc/lib/libPython/xbmcmodule/controlspin.cpp (revision 20410)
- +++ xbmc/lib/libPython/xbmcmodule/controlspin.cpp (working copy)
- @@ -41,9 +41,9 @@
- namespace PYXBMC
- {
- - /*
- +
- // not used for now
- - PyObject* ControlSpin_New(PyTypeObject *type, PyObject *args, PyObject *kwds)
- + PyObject* ControlSpin1_New(PyTypeObject *type, PyObject *args, PyObject *kwds)
- {
- ControlSpin *self;
- char* cTextureFocus = NULL;
- @@ -60,23 +60,27 @@
- if (!PyArg_ParseTuple(args, "llll|Oss", &self->dwPosX, &self->dwPosY, &self->dwWidth, &self->dwHeight,
- &pObjectText, &cTextureFocus, &cTextureNoFocus)) return NULL;
- - if (!PyGetUnicodeString(self->strText, pObjectText, 5)) return NULL;
- + //if (!PyGetUnicodeString(self->strText, pObjectText, 5)) return NULL;
- - // SetLabel(const CStdString& strFontName,const CStdString& strLabel,D3DCOLOR dwColor)
- - self->strFont = "font13";
- - self->dwTextColor = 0xffffffff;
- - self->dwDisabledColor = 0x60ffffff;
- + // default values for spin control
- + self->dwColor = 0xffffffff;
- - self->strTextureFocus = cTextureFocus ? cTextureFocus : "button-focus.png";
- - self->strTextureNoFocus = cTextureNoFocus ? cTextureNoFocus : "button-nofocus.jpg";
- + //SetLabel(const CStdString& strFontName,const CStdString& strLabel,D3DCOLOR dwColor);
- + //self->strFont = "font13";
- + //self->dwTextColor = 0xffffffff;
- + //self->dwDisabledColor = 0x60ffffff;
- + //self->strTextureFocus = cTextureFocus ? cTextureFocus : "button-focus.png";
- + //self->strTextureNoFocus = cTextureNoFocus ? cTextureNoFocus : "button-nofocus.jpg";
- +
- return (PyObject*)self;
- }
- -*/
- +
- /*
- * allocate a new controlspin. Used for c++ and not the python user
- */
- - PyObject* ControlSpin_New()
- +
- + PyObject* ControlSpin_New()
- {
- //ControlSpin* self = (ControlSpin*)_PyObject_New(&ControlSpin_Type);
- ControlSpin*self = (ControlSpin*)ControlSpin_Type.tp_alloc(&ControlSpin_Type, 0);
- @@ -111,6 +115,80 @@
- self->ob_type->tp_free((PyObject*)self);
- }
- + CGUIControl* ControlSpin_Create(ControlSpin* pControl)
- + {
- + CLabelInfo label;
- +/* label.font = g_fontManager.GetFont(pControl->strFont);
- + label.textColor = pControl->dwTextColor;
- + label.disabledColor = pControl->dwDisabledColor;
- + label.shadowColor = pControl->dwShadowColor;
- + label.focusedColor = pControl->dwFocusedColor;
- + label.align = pControl->dwAlign;
- + label.offsetX = (float)pControl->dwTextXOffset;
- + label.offsetY = (float)pControl->dwTextYOffset;
- + label.angle = (float)-pControl->iAngle;
- +*/
- + pControl->pGUIControl = new CGUISpinControl(
- + pControl->iParentId,
- + pControl->iControlId,
- + (float)pControl->dwPosX,
- + (float)pControl->dwPosY,
- + (float)pControl->dwWidth,
- + (float)pControl->dwHeight,
- + (CStdString)pControl->strTextureUp,
- + (CStdString)pControl->strTextureDown,
- + (CStdString)pControl->strTextureUpFocus,
- + (CStdString)pControl->strTextureDownFocus,
- + label,
- + SPIN_CONTROL_TYPE_PAGE
- + );
- + CLog::Log(LOGNOTICE, "CnotrolSpin_Create invoked");
- + return pControl->pGUIControl;
- + }
- +
- + // MoveUp() Method
- + PyDoc_STRVAR(moveUp__doc__,
- + "pageUp() -- Invokes the MoveUp method of the spin control."
- + "\n"
- + "example:\n"
- + " - self.controlspin.moveUp()");
- +
- +
- + PyObject* ControlSpin_MoveUp(ControlSpin *self, PyObject *args)
- + {
- + ControlSpin *pControl = (ControlSpin*)self;
- + PyGUILock();
- + static_cast<CGUISpinControl*>(pControl->pGUIControl)->MoveUp();
- +
- + PyGUIUnlock();
- +
- + Py_INCREF(Py_None);
- + return Py_None;
- +
- + }
- +
- + // MoveDown() Method
- + PyDoc_STRVAR(moveDown__doc__,
- + "pageDown() -- Invokes the MoveDown method of the spin control."
- + "\n"
- + "example:\n"
- + " - self.controlspin.pageDown()");
- +
- +
- + PyObject* ControlSpin_MoveDown(ControlSpin *self, PyObject *args)
- + {
- + ControlSpin *pControl = (ControlSpin*)self;
- + PyGUILock();
- + static_cast<CGUISpinControl*>(pControl->pGUIControl)->MoveDown();
- +
- + PyGUIUnlock();
- +
- + Py_INCREF(Py_None);
- + return Py_None;
- +
- + }
- +
- +
- PyObject* ControlSpin_SetColor(ControlSpin *self, PyObject *args)
- {
- char *cColor = NULL;
- @@ -162,6 +240,8 @@
- PyMethodDef ControlSpin_methods[] = {
- //{(char*)"setColor", (PyCFunction)ControlSpin_SetColor, METH_VARARGS, ""},
- {(char*)"setTextures", (PyCFunction)ControlSpin_SetTextures, METH_VARARGS, setTextures__doc__},
- + {(char*)"moveUp", (PyCFunction)ControlSpin_MoveUp, METH_VARARGS, moveUp__doc__},
- + {(char*)"moveDown", (PyCFunction)ControlSpin_MoveDown, METH_VARARGS, moveDown__doc__},
- {NULL, NULL, 0, NULL}
- };
- @@ -194,7 +274,7 @@
- ControlSpin_Type.tp_doc = controlSpin__doc__;
- ControlSpin_Type.tp_methods = ControlSpin_methods;
- ControlSpin_Type.tp_base = &Control_Type;
- - ControlSpin_Type.tp_new = 0; //ControlSpin_New
- + ControlSpin_Type.tp_new = ControlSpin1_New; // 0
- }
- }
- Index: xbmc/lib/libPython/XBPython.cpp
- ===================================================================
- --- xbmc/lib/libPython/XBPython.cpp (revision 20410)
- +++ xbmc/lib/libPython/XBPython.cpp (working copy)
- @@ -248,9 +248,9 @@
- void XBPython::DeInitializeInterpreter()
- {
- - DeinitXBMCModule();
- + //DeinitXBMCModule();
- DeinitPluginModule();
- - DeinitGUIModule();
- + //DeinitGUIModule();
- }
- /**
- Index: guilib/GUISpinControl.h
- ===================================================================
- --- guilib/GUISpinControl.h (revision 20410)
- +++ guilib/GUISpinControl.h (working copy)
- @@ -85,6 +85,8 @@
- void Clear();
- virtual CStdString GetDescription() const;
- bool IsFocusedOnUp() const;
- + void MoveUp(bool bTestReverse = true);
- + void MoveDown(bool bTestReverse = true);
- virtual bool IsVisible() const;
- @@ -94,8 +96,6 @@
- void PageDown();
- bool CanMoveDown(bool bTestReverse = true);
- bool CanMoveUp(bool bTestReverse = true);
- - void MoveUp(bool bTestReverse = true);
- - void MoveDown(bool bTestReverse = true);
- void ChangePage(int amount);
- int m_iStart;
- int m_iEnd;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement