bugfix
This commit is contained in:
parent
a16e627922
commit
8a8308a3fc
@ -2,7 +2,8 @@ import sys
|
|||||||
import math
|
import math
|
||||||
from traceback import print_exc
|
from traceback import print_exc
|
||||||
|
|
||||||
from kivy.properties import ObjectProperty, StringProperty
|
from kivy.properties import ObjectProperty, StringProperty, \
|
||||||
|
NumericProperty, BooleanProperty
|
||||||
from kivy.app import App
|
from kivy.app import App
|
||||||
from kivy.utils import platform
|
from kivy.utils import platform
|
||||||
from kivy.uix.button import Button, ButtonBehavior
|
from kivy.uix.button import Button, ButtonBehavior
|
||||||
@ -51,8 +52,7 @@ from kivy.uix.carousel import Carousel
|
|||||||
from kivy.uix.bubble import Bubble
|
from kivy.uix.bubble import Bubble
|
||||||
from kivy.uix.codeinput import CodeInput
|
from kivy.uix.codeinput import CodeInput
|
||||||
from kivy.graphics import Color, Rectangle
|
from kivy.graphics import Color, Rectangle
|
||||||
from kivy.properties import ListProperty
|
from kivy.properties import ListProperty, DictProperty
|
||||||
from kivycalendar import DatePicker
|
|
||||||
from kivy.factory import Factory
|
from kivy.factory import Factory
|
||||||
|
|
||||||
from appPublic.dictObject import DictObject
|
from appPublic.dictObject import DictObject
|
||||||
@ -221,17 +221,16 @@ class Title6(Text):
|
|||||||
kw.update({'texttype':'title6','bold':True})
|
kw.update({'texttype':'title6','bold':True})
|
||||||
Text.__init__(self, **kw)
|
Text.__init__(self, **kw)
|
||||||
|
|
||||||
class Modal(ModalView):
|
class Modal(WidgetCSS, WidgetReady, ModalView):
|
||||||
def __init__(self, auto_open=False,
|
content = DictProperty(None)
|
||||||
content=None,
|
auto_open = BooleanProperty(True)
|
||||||
**kw):
|
def __init__(self, **kw):
|
||||||
ModalView.__init__(self, **kw)
|
super(ModalView, self).__init__(**kw)
|
||||||
self.auto_open = auto_open
|
|
||||||
if content:
|
|
||||||
blocks = Factory.Blocks()
|
|
||||||
self.content = blocks.widgetBuild(content)
|
|
||||||
if self.content:
|
if self.content:
|
||||||
self.add_widget(self.content)
|
blocks = Factory.Blocks()
|
||||||
|
self.content_w = blocks.widgetBuild(self.content)
|
||||||
|
if self.content_w:
|
||||||
|
self.add_widget(self.content_w)
|
||||||
else:
|
else:
|
||||||
print(content,':cannot build widget')
|
print(content,':cannot build widget')
|
||||||
|
|
||||||
@ -242,12 +241,15 @@ class Modal(ModalView):
|
|||||||
self.open()
|
self.open()
|
||||||
|
|
||||||
class TimedModal(Modal):
|
class TimedModal(Modal):
|
||||||
def __init__(self, show_time=5, **kw):
|
show_time = NumericProperty(0)
|
||||||
self.show_time = show_time
|
def __init__(self, **kw):
|
||||||
self.time_task = None
|
self.time_task = None
|
||||||
Modal.__init__(self, **kw)
|
Modal.__init__(self, **kw)
|
||||||
|
|
||||||
def open(self, *args, **kw):
|
def open(self, *args, **kw):
|
||||||
|
if self.time_task is not None:
|
||||||
|
self.time_task.cancel()
|
||||||
|
self.time_task = None
|
||||||
if self.show_time > 0:
|
if self.show_time > 0:
|
||||||
self.time_task = \
|
self.time_task = \
|
||||||
Clock.schedule_once(self.dismiss, self.show_time)
|
Clock.schedule_once(self.dismiss, self.show_time)
|
||||||
|
6464
kivyblocks/blocks.c
6464
kivyblocks/blocks.c
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,6 @@ import codecs
|
|||||||
import ujson as json
|
import ujson as json
|
||||||
from traceback import print_exc
|
from traceback import print_exc
|
||||||
|
|
||||||
import kivy
|
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
from appPublic.dictExt import dictExtend
|
from appPublic.dictExt import dictExtend
|
||||||
@ -20,6 +19,7 @@ from kivy.metrics import sp,dp,mm
|
|||||||
from kivy.core.window import WindowBase, Window
|
from kivy.core.window import WindowBase, Window
|
||||||
from kivy.properties import BooleanProperty
|
from kivy.properties import BooleanProperty
|
||||||
from kivy.uix.widget import Widget
|
from kivy.uix.widget import Widget
|
||||||
|
from kivy.uix.modalview import ModalView
|
||||||
from kivy.app import App
|
from kivy.app import App
|
||||||
from kivy.factory import Factory
|
from kivy.factory import Factory
|
||||||
from kivy.uix.video import Video
|
from kivy.uix.video import Video
|
||||||
@ -128,7 +128,6 @@ class Blocks(EventDispatcher):
|
|||||||
func =partial(blocks.conform_action,widget, desc)
|
func =partial(blocks.conform_action,widget, desc)
|
||||||
return func
|
return func
|
||||||
|
|
||||||
|
|
||||||
def eval(self, s:str, l:dict):
|
def eval(self, s:str, l:dict):
|
||||||
g = {}
|
g = {}
|
||||||
forbidens = [
|
forbidens = [
|
||||||
@ -413,6 +412,9 @@ class Blocks(EventDispatcher):
|
|||||||
p.update(d)
|
p.update(d)
|
||||||
opts['options'] = p
|
opts['options'] = p
|
||||||
def doit(target:Widget, add_mode:str, o, w:Widget):
|
def doit(target:Widget, add_mode:str, o, w:Widget):
|
||||||
|
if isinstance(w, ModalView):
|
||||||
|
return
|
||||||
|
|
||||||
if target:
|
if target:
|
||||||
if add_mode == 'replace':
|
if add_mode == 'replace':
|
||||||
target.clear_widgets()
|
target.clear_widgets()
|
||||||
@ -429,6 +431,10 @@ class Blocks(EventDispatcher):
|
|||||||
b.widgetBuild(opts)
|
b.widgetBuild(opts)
|
||||||
|
|
||||||
def urlwidgetAction(self, widget:Widget, desc, *args):
|
def urlwidgetAction(self, widget:Widget, desc, *args):
|
||||||
|
Logger.info('Block: urlwidgetAction() called, desc=%s, args=%s', \
|
||||||
|
str(desc),
|
||||||
|
args
|
||||||
|
)
|
||||||
target = self.get_target(widget, desc)
|
target = self.get_target(widget, desc)
|
||||||
add_mode = desc.get('mode','replace')
|
add_mode = desc.get('mode','replace')
|
||||||
opts = desc.get('options').copy()
|
opts = desc.get('options').copy()
|
||||||
@ -445,6 +451,9 @@ class Blocks(EventDispatcher):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def doit(target:Widget, add_mode:str, o, w:Widget):
|
def doit(target:Widget, add_mode:str, o, w:Widget):
|
||||||
|
if isinstance(w, ModalView):
|
||||||
|
return
|
||||||
|
|
||||||
if target:
|
if target:
|
||||||
if add_mode == 'replace':
|
if add_mode == 'replace':
|
||||||
target.clear_widgets()
|
target.clear_widgets()
|
||||||
@ -460,9 +469,14 @@ class Blocks(EventDispatcher):
|
|||||||
b.widgetBuild(d)
|
b.widgetBuild(d)
|
||||||
|
|
||||||
def getActionData(self, widget:Widget, desc, *args):
|
def getActionData(self, widget:Widget, desc, *args):
|
||||||
|
Logger.info('Block: getActionData(): desc=%s args=%s'
|
||||||
|
,str(desc), args)
|
||||||
|
|
||||||
data = {}
|
data = {}
|
||||||
rtdesc = self.build_rtdesc(desc)
|
rtdesc = self.build_rtdesc(desc)
|
||||||
|
if rtdesc:
|
||||||
rt = self.get_rtdata(widget, rtdesc, *args)
|
rt = self.get_rtdata(widget, rtdesc, *args)
|
||||||
|
if rt:
|
||||||
data.update(rt)
|
data.update(rt)
|
||||||
if desc.get('keymapping'):
|
if desc.get('keymapping'):
|
||||||
data = keyMapping(data, desc.get('keymapping'))
|
data = keyMapping(data, desc.get('keymapping'))
|
||||||
@ -516,8 +530,6 @@ class Blocks(EventDispatcher):
|
|||||||
else:
|
else:
|
||||||
rtdesc['method'] = desc.get('datamethod', 'getValue')
|
rtdesc['method'] = desc.get('datamethod', 'getValue')
|
||||||
rtdesc['kwargs'] = desc.get('datakwargs', {})
|
rtdesc['kwargs'] = desc.get('datakwargs', {})
|
||||||
else:
|
|
||||||
return {}
|
|
||||||
return rtdesc
|
return rtdesc
|
||||||
|
|
||||||
def get_rtdata(self, widget:Widget, desc, *args):
|
def get_rtdata(self, widget:Widget, desc, *args):
|
||||||
@ -730,6 +742,7 @@ class Blocks(EventDispatcher):
|
|||||||
and Window.fullscreen == True \
|
and Window.fullscreen == True \
|
||||||
and app.root != app.fs_widget:
|
and app.root != app.fs_widget:
|
||||||
w = find_widget_by_id(id, app.fs_widget)
|
w = find_widget_by_id(id, app.fs_widget)
|
||||||
|
|
||||||
if w is None:
|
if w is None:
|
||||||
print(id, 'not found ....')
|
print(id, 'not found ....')
|
||||||
return None
|
return None
|
||||||
|
@ -91,12 +91,14 @@ class ClickableIconText(ClickableText):
|
|||||||
SUPER(ClickableIconText, self, kw)
|
SUPER(ClickableIconText, self, kw)
|
||||||
|
|
||||||
def on_source(self, o, source):
|
def on_source(self, o, source):
|
||||||
if self.img_w:
|
|
||||||
if source is None:
|
if source is None:
|
||||||
source = blockIamge('broken.png')
|
source = blockIamge('broken.png')
|
||||||
|
|
||||||
|
if self.img_w:
|
||||||
self.img_w.source = source
|
self.img_w.source = source
|
||||||
return
|
return
|
||||||
self.img_w = AsyncImage(source=self.source, **self.img_kw)
|
|
||||||
|
self.img_w = AsyncImage(source=source, **self.img_kw)
|
||||||
self.add_widget(self.img_w, index=len(self.children))
|
self.add_widget(self.img_w, index=len(self.children))
|
||||||
|
|
||||||
class ToggleText(ClickableText):
|
class ToggleText(ClickableText):
|
||||||
|
56
kivyblocks/command_action.py
Normal file
56
kivyblocks/command_action.py
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
|
||||||
|
from functools import partial
|
||||||
|
from kivy.logger import Logger
|
||||||
|
from kivy.factory import Factory
|
||||||
|
|
||||||
|
def get_cmd_desc(cmd_desc):
|
||||||
|
desc = {
|
||||||
|
}
|
||||||
|
v = cmd_desc
|
||||||
|
desc['target'] = v.get('target')
|
||||||
|
if v.get('datawidget'):
|
||||||
|
desc['datawidget'] = v.get('datawidget')
|
||||||
|
if v.get('datamethod'):
|
||||||
|
desc['datamethod'] = v['datamethod']
|
||||||
|
keys = v.keys()
|
||||||
|
if 'url' in keys:
|
||||||
|
desc['actiontype'] = 'urlwidget'
|
||||||
|
desc['mode'] = 'replace'
|
||||||
|
options = {
|
||||||
|
'params':v.get('params',{}),
|
||||||
|
'url':v.get('url')
|
||||||
|
}
|
||||||
|
desc['options'] = options
|
||||||
|
return desc
|
||||||
|
if 'rfname' in keys:
|
||||||
|
desc['actiontype'] = 'registedfunction'
|
||||||
|
desc['params'] = v.get('params',{})
|
||||||
|
return desc
|
||||||
|
if 'script' in keys:
|
||||||
|
desc['actiontype'] = 'script'
|
||||||
|
desc['script'] = v.get('script')
|
||||||
|
return desc
|
||||||
|
if 'method' in keys:
|
||||||
|
desc['actiontype'] = 'method'
|
||||||
|
desc['method'] = v.get('method')
|
||||||
|
return desc
|
||||||
|
if 'actions' in keys:
|
||||||
|
desc['actiontype'] = 'multiple'
|
||||||
|
desc['actions'] = v.get('actions')
|
||||||
|
return desc
|
||||||
|
return None
|
||||||
|
|
||||||
|
def cmd_action(cmd_desc, widget):
|
||||||
|
desc = get_cmd_desc(cmd_desc)
|
||||||
|
if desc is None:
|
||||||
|
Logger.error('CommandAction: cmd_desc=%s error')
|
||||||
|
return
|
||||||
|
blocks = Factory.Blocks()
|
||||||
|
if 'conform' in cmd_desc:
|
||||||
|
options = cmd_desc['conform']
|
||||||
|
w = Factory.Conform(**options)
|
||||||
|
f = partial(blocks.uniaction, widget, desc)
|
||||||
|
w.bind(on_conform=f)
|
||||||
|
return
|
||||||
|
blocks.uniaction(widget, desc)
|
||||||
|
|
110
kivyblocks/dg.c
110
kivyblocks/dg.c
@ -17152,6 +17152,7 @@ static PyObject *__pyx_pw_10kivyblocks_2dg_8DataGrid_65get_selected_data(PyObjec
|
|||||||
|
|
||||||
static PyObject *__pyx_pf_10kivyblocks_2dg_8DataGrid_64get_selected_data(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
|
static PyObject *__pyx_pf_10kivyblocks_2dg_8DataGrid_64get_selected_data(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
|
||||||
PyObject *__pyx_v_data = NULL;
|
PyObject *__pyx_v_data = NULL;
|
||||||
|
PyObject *__pyx_v_row_id = NULL;
|
||||||
PyObject *__pyx_v_row = NULL;
|
PyObject *__pyx_v_row = NULL;
|
||||||
PyObject *__pyx_r = NULL;
|
PyObject *__pyx_r = NULL;
|
||||||
__Pyx_RefNannyDeclarations
|
__Pyx_RefNannyDeclarations
|
||||||
@ -17160,7 +17161,6 @@ static PyObject *__pyx_pf_10kivyblocks_2dg_8DataGrid_64get_selected_data(CYTHON_
|
|||||||
int __pyx_t_3;
|
int __pyx_t_3;
|
||||||
PyObject *__pyx_t_4 = NULL;
|
PyObject *__pyx_t_4 = NULL;
|
||||||
PyObject *__pyx_t_5 = NULL;
|
PyObject *__pyx_t_5 = NULL;
|
||||||
PyObject *__pyx_t_6 = NULL;
|
|
||||||
int __pyx_lineno = 0;
|
int __pyx_lineno = 0;
|
||||||
const char *__pyx_filename = NULL;
|
const char *__pyx_filename = NULL;
|
||||||
int __pyx_clineno = 0;
|
int __pyx_clineno = 0;
|
||||||
@ -17185,7 +17185,7 @@ static PyObject *__pyx_pf_10kivyblocks_2dg_8DataGrid_64get_selected_data(CYTHON_
|
|||||||
* if not self.selected_rowid:
|
* if not self.selected_rowid:
|
||||||
* return {} # <<<<<<<<<<<<<<
|
* return {} # <<<<<<<<<<<<<<
|
||||||
* data = {}
|
* data = {}
|
||||||
* if self.freeze_part:
|
* row_id = self.selected_rowid
|
||||||
*/
|
*/
|
||||||
__Pyx_XDECREF(__pyx_r);
|
__Pyx_XDECREF(__pyx_r);
|
||||||
__pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 605, __pyx_L1_error)
|
__pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 605, __pyx_L1_error)
|
||||||
@ -17207,8 +17207,8 @@ static PyObject *__pyx_pf_10kivyblocks_2dg_8DataGrid_64get_selected_data(CYTHON_
|
|||||||
* if not self.selected_rowid:
|
* if not self.selected_rowid:
|
||||||
* return {}
|
* return {}
|
||||||
* data = {} # <<<<<<<<<<<<<<
|
* data = {} # <<<<<<<<<<<<<<
|
||||||
|
* row_id = self.selected_rowid
|
||||||
* if self.freeze_part:
|
* if self.freeze_part:
|
||||||
* row = self.freeze_part.body.get_row_by_id(row_id)
|
|
||||||
*/
|
*/
|
||||||
__pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 606, __pyx_L1_error)
|
__pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 606, __pyx_L1_error)
|
||||||
__Pyx_GOTREF(__pyx_t_1);
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
@ -17218,122 +17218,140 @@ static PyObject *__pyx_pf_10kivyblocks_2dg_8DataGrid_64get_selected_data(CYTHON_
|
|||||||
/* "kivyblocks/dg.pyx":607
|
/* "kivyblocks/dg.pyx":607
|
||||||
* return {}
|
* return {}
|
||||||
* data = {}
|
* data = {}
|
||||||
|
* row_id = self.selected_rowid # <<<<<<<<<<<<<<
|
||||||
|
* if self.freeze_part:
|
||||||
|
* row = self.freeze_part.body.get_row_by_id(row_id)
|
||||||
|
*/
|
||||||
|
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_selected_rowid); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 607, __pyx_L1_error)
|
||||||
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
|
__pyx_v_row_id = __pyx_t_1;
|
||||||
|
__pyx_t_1 = 0;
|
||||||
|
|
||||||
|
/* "kivyblocks/dg.pyx":608
|
||||||
|
* data = {}
|
||||||
|
* row_id = self.selected_rowid
|
||||||
* if self.freeze_part: # <<<<<<<<<<<<<<
|
* if self.freeze_part: # <<<<<<<<<<<<<<
|
||||||
* row = self.freeze_part.body.get_row_by_id(row_id)
|
* row = self.freeze_part.body.get_row_by_id(row_id)
|
||||||
* data.update(row.row_data)
|
* data.update(row.row_data)
|
||||||
*/
|
*/
|
||||||
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_freeze_part); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 607, __pyx_L1_error)
|
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_freeze_part); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 608, __pyx_L1_error)
|
||||||
__Pyx_GOTREF(__pyx_t_1);
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
__pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 607, __pyx_L1_error)
|
__pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 608, __pyx_L1_error)
|
||||||
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
||||||
if (__pyx_t_3) {
|
if (__pyx_t_3) {
|
||||||
|
|
||||||
/* "kivyblocks/dg.pyx":608
|
/* "kivyblocks/dg.pyx":609
|
||||||
* data = {}
|
* row_id = self.selected_rowid
|
||||||
* if self.freeze_part:
|
* if self.freeze_part:
|
||||||
* row = self.freeze_part.body.get_row_by_id(row_id) # <<<<<<<<<<<<<<
|
* row = self.freeze_part.body.get_row_by_id(row_id) # <<<<<<<<<<<<<<
|
||||||
* data.update(row.row_data)
|
* data.update(row.row_data)
|
||||||
* row = self.normal_part.body.get_row_by_id(row_id)
|
* row = self.normal_part.body.get_row_by_id(row_id)
|
||||||
*/
|
*/
|
||||||
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_freeze_part); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 608, __pyx_L1_error)
|
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_freeze_part); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 609, __pyx_L1_error)
|
||||||
__Pyx_GOTREF(__pyx_t_4);
|
__Pyx_GOTREF(__pyx_t_4);
|
||||||
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_body); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 608, __pyx_L1_error)
|
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_body); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 609, __pyx_L1_error)
|
||||||
__Pyx_GOTREF(__pyx_t_5);
|
__Pyx_GOTREF(__pyx_t_5);
|
||||||
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
||||||
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_get_row_by_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 608, __pyx_L1_error)
|
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_get_row_by_id); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 609, __pyx_L1_error)
|
||||||
__Pyx_GOTREF(__pyx_t_4);
|
__Pyx_GOTREF(__pyx_t_4);
|
||||||
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
|
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
|
||||||
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_row_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 608, __pyx_L1_error)
|
__pyx_t_5 = NULL;
|
||||||
__Pyx_GOTREF(__pyx_t_5);
|
|
||||||
__pyx_t_6 = NULL;
|
|
||||||
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
|
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
|
||||||
__pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
|
__pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
|
||||||
if (likely(__pyx_t_6)) {
|
if (likely(__pyx_t_5)) {
|
||||||
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
|
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
|
||||||
__Pyx_INCREF(__pyx_t_6);
|
__Pyx_INCREF(__pyx_t_5);
|
||||||
__Pyx_INCREF(function);
|
__Pyx_INCREF(function);
|
||||||
__Pyx_DECREF_SET(__pyx_t_4, function);
|
__Pyx_DECREF_SET(__pyx_t_4, function);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
__pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5);
|
__pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_row_id) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_row_id);
|
||||||
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
|
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
|
||||||
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
|
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 609, __pyx_L1_error)
|
||||||
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 608, __pyx_L1_error)
|
|
||||||
__Pyx_GOTREF(__pyx_t_1);
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
||||||
__pyx_v_row = __pyx_t_1;
|
__pyx_v_row = __pyx_t_1;
|
||||||
__pyx_t_1 = 0;
|
__pyx_t_1 = 0;
|
||||||
|
|
||||||
/* "kivyblocks/dg.pyx":609
|
/* "kivyblocks/dg.pyx":610
|
||||||
* if self.freeze_part:
|
* if self.freeze_part:
|
||||||
* row = self.freeze_part.body.get_row_by_id(row_id)
|
* row = self.freeze_part.body.get_row_by_id(row_id)
|
||||||
* data.update(row.row_data) # <<<<<<<<<<<<<<
|
* data.update(row.row_data) # <<<<<<<<<<<<<<
|
||||||
* row = self.normal_part.body.get_row_by_id(row_id)
|
* row = self.normal_part.body.get_row_by_id(row_id)
|
||||||
* data.update(row.row_data)
|
* data.update(row.row_data)
|
||||||
*/
|
*/
|
||||||
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_row, __pyx_n_s_row_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 609, __pyx_L1_error)
|
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_row, __pyx_n_s_row_data); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 610, __pyx_L1_error)
|
||||||
__Pyx_GOTREF(__pyx_t_1);
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
__pyx_t_4 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_update, __pyx_v_data, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 609, __pyx_L1_error)
|
__pyx_t_4 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_update, __pyx_v_data, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 610, __pyx_L1_error)
|
||||||
__Pyx_GOTREF(__pyx_t_4);
|
__Pyx_GOTREF(__pyx_t_4);
|
||||||
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
||||||
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
||||||
|
|
||||||
/* "kivyblocks/dg.pyx":607
|
/* "kivyblocks/dg.pyx":608
|
||||||
* return {}
|
|
||||||
* data = {}
|
* data = {}
|
||||||
|
* row_id = self.selected_rowid
|
||||||
* if self.freeze_part: # <<<<<<<<<<<<<<
|
* if self.freeze_part: # <<<<<<<<<<<<<<
|
||||||
* row = self.freeze_part.body.get_row_by_id(row_id)
|
* row = self.freeze_part.body.get_row_by_id(row_id)
|
||||||
* data.update(row.row_data)
|
* data.update(row.row_data)
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "kivyblocks/dg.pyx":610
|
/* "kivyblocks/dg.pyx":611
|
||||||
* row = self.freeze_part.body.get_row_by_id(row_id)
|
* row = self.freeze_part.body.get_row_by_id(row_id)
|
||||||
* data.update(row.row_data)
|
* data.update(row.row_data)
|
||||||
* row = self.normal_part.body.get_row_by_id(row_id) # <<<<<<<<<<<<<<
|
* row = self.normal_part.body.get_row_by_id(row_id) # <<<<<<<<<<<<<<
|
||||||
* data.update(row.row_data)
|
* data.update(row.row_data)
|
||||||
|
* return data
|
||||||
*/
|
*/
|
||||||
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_normal_part); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 610, __pyx_L1_error)
|
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_normal_part); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 611, __pyx_L1_error)
|
||||||
__Pyx_GOTREF(__pyx_t_1);
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_body); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 610, __pyx_L1_error)
|
__pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_body); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 611, __pyx_L1_error)
|
||||||
__Pyx_GOTREF(__pyx_t_5);
|
__Pyx_GOTREF(__pyx_t_5);
|
||||||
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
||||||
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_get_row_by_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 610, __pyx_L1_error)
|
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_get_row_by_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 611, __pyx_L1_error)
|
||||||
__Pyx_GOTREF(__pyx_t_1);
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
|
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
|
||||||
__Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_row_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 610, __pyx_L1_error)
|
__pyx_t_5 = NULL;
|
||||||
__Pyx_GOTREF(__pyx_t_5);
|
|
||||||
__pyx_t_6 = NULL;
|
|
||||||
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
|
if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
|
||||||
__pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
|
__pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
|
||||||
if (likely(__pyx_t_6)) {
|
if (likely(__pyx_t_5)) {
|
||||||
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
|
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
|
||||||
__Pyx_INCREF(__pyx_t_6);
|
__Pyx_INCREF(__pyx_t_5);
|
||||||
__Pyx_INCREF(function);
|
__Pyx_INCREF(function);
|
||||||
__Pyx_DECREF_SET(__pyx_t_1, function);
|
__Pyx_DECREF_SET(__pyx_t_1, function);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
__pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5);
|
__pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v_row_id) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_row_id);
|
||||||
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
|
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
|
||||||
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
|
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 611, __pyx_L1_error)
|
||||||
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 610, __pyx_L1_error)
|
|
||||||
__Pyx_GOTREF(__pyx_t_4);
|
__Pyx_GOTREF(__pyx_t_4);
|
||||||
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
||||||
__Pyx_XDECREF_SET(__pyx_v_row, __pyx_t_4);
|
__Pyx_XDECREF_SET(__pyx_v_row, __pyx_t_4);
|
||||||
__pyx_t_4 = 0;
|
__pyx_t_4 = 0;
|
||||||
|
|
||||||
/* "kivyblocks/dg.pyx":611
|
/* "kivyblocks/dg.pyx":612
|
||||||
* data.update(row.row_data)
|
* data.update(row.row_data)
|
||||||
* row = self.normal_part.body.get_row_by_id(row_id)
|
* row = self.normal_part.body.get_row_by_id(row_id)
|
||||||
* data.update(row.row_data) # <<<<<<<<<<<<<<
|
* data.update(row.row_data) # <<<<<<<<<<<<<<
|
||||||
|
* return data
|
||||||
*/
|
*/
|
||||||
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_row, __pyx_n_s_row_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 611, __pyx_L1_error)
|
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_row, __pyx_n_s_row_data); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 612, __pyx_L1_error)
|
||||||
__Pyx_GOTREF(__pyx_t_4);
|
__Pyx_GOTREF(__pyx_t_4);
|
||||||
__pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_update, __pyx_v_data, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 611, __pyx_L1_error)
|
__pyx_t_1 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_update, __pyx_v_data, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 612, __pyx_L1_error)
|
||||||
__Pyx_GOTREF(__pyx_t_1);
|
__Pyx_GOTREF(__pyx_t_1);
|
||||||
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
||||||
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
||||||
|
|
||||||
|
/* "kivyblocks/dg.pyx":613
|
||||||
|
* row = self.normal_part.body.get_row_by_id(row_id)
|
||||||
|
* data.update(row.row_data)
|
||||||
|
* return data # <<<<<<<<<<<<<<
|
||||||
|
*/
|
||||||
|
__Pyx_XDECREF(__pyx_r);
|
||||||
|
__Pyx_INCREF(__pyx_v_data);
|
||||||
|
__pyx_r = __pyx_v_data;
|
||||||
|
goto __pyx_L0;
|
||||||
|
|
||||||
/* "kivyblocks/dg.pyx":603
|
/* "kivyblocks/dg.pyx":603
|
||||||
* return fs
|
* return fs
|
||||||
*
|
*
|
||||||
@ -17343,17 +17361,15 @@ static PyObject *__pyx_pf_10kivyblocks_2dg_8DataGrid_64get_selected_data(CYTHON_
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* function exit code */
|
/* function exit code */
|
||||||
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
|
|
||||||
goto __pyx_L0;
|
|
||||||
__pyx_L1_error:;
|
__pyx_L1_error:;
|
||||||
__Pyx_XDECREF(__pyx_t_1);
|
__Pyx_XDECREF(__pyx_t_1);
|
||||||
__Pyx_XDECREF(__pyx_t_4);
|
__Pyx_XDECREF(__pyx_t_4);
|
||||||
__Pyx_XDECREF(__pyx_t_5);
|
__Pyx_XDECREF(__pyx_t_5);
|
||||||
__Pyx_XDECREF(__pyx_t_6);
|
|
||||||
__Pyx_AddTraceback("kivyblocks.dg.DataGrid.get_selected_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
__Pyx_AddTraceback("kivyblocks.dg.DataGrid.get_selected_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
||||||
__pyx_r = NULL;
|
__pyx_r = NULL;
|
||||||
__pyx_L0:;
|
__pyx_L0:;
|
||||||
__Pyx_XDECREF(__pyx_v_data);
|
__Pyx_XDECREF(__pyx_v_data);
|
||||||
|
__Pyx_XDECREF(__pyx_v_row_id);
|
||||||
__Pyx_XDECREF(__pyx_v_row);
|
__Pyx_XDECREF(__pyx_v_row);
|
||||||
__Pyx_XGIVEREF(__pyx_r);
|
__Pyx_XGIVEREF(__pyx_r);
|
||||||
__Pyx_RefNannyFinishContext();
|
__Pyx_RefNannyFinishContext();
|
||||||
@ -18703,10 +18719,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
|
|||||||
* if not self.selected_rowid:
|
* if not self.selected_rowid:
|
||||||
* return {}
|
* return {}
|
||||||
*/
|
*/
|
||||||
__pyx_tuple__129 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_data, __pyx_n_s_row); if (unlikely(!__pyx_tuple__129)) __PYX_ERR(0, 603, __pyx_L1_error)
|
__pyx_tuple__129 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_data, __pyx_n_s_row_id, __pyx_n_s_row); if (unlikely(!__pyx_tuple__129)) __PYX_ERR(0, 603, __pyx_L1_error)
|
||||||
__Pyx_GOTREF(__pyx_tuple__129);
|
__Pyx_GOTREF(__pyx_tuple__129);
|
||||||
__Pyx_GIVEREF(__pyx_tuple__129);
|
__Pyx_GIVEREF(__pyx_tuple__129);
|
||||||
__pyx_codeobj__130 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__129, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_kivyblocks_dg_pyx, __pyx_n_s_get_selected_data, 603, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__130)) __PYX_ERR(0, 603, __pyx_L1_error)
|
__pyx_codeobj__130 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__129, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_kivyblocks_dg_pyx, __pyx_n_s_get_selected_data, 603, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__130)) __PYX_ERR(0, 603, __pyx_L1_error)
|
||||||
__Pyx_RefNannyFinishContext();
|
__Pyx_RefNannyFinishContext();
|
||||||
return 0;
|
return 0;
|
||||||
__pyx_L1_error:;
|
__pyx_L1_error:;
|
||||||
|
@ -604,8 +604,10 @@ class DataGrid(VBox):
|
|||||||
if not self.selected_rowid:
|
if not self.selected_rowid:
|
||||||
return {}
|
return {}
|
||||||
data = {}
|
data = {}
|
||||||
|
row_id = self.selected_rowid
|
||||||
if self.freeze_part:
|
if self.freeze_part:
|
||||||
row = self.freeze_part.body.get_row_by_id(row_id)
|
row = self.freeze_part.body.get_row_by_id(row_id)
|
||||||
data.update(row.row_data)
|
data.update(row.row_data)
|
||||||
row = self.normal_part.body.get_row_by_id(row_id)
|
row = self.normal_part.body.get_row_by_id(row_id)
|
||||||
data.update(row.row_data)
|
data.update(row.row_data)
|
||||||
|
return data
|
||||||
|
@ -1,29 +1,60 @@
|
|||||||
|
|
||||||
from kivy.factory import Factory
|
from kivy.factory import Factory
|
||||||
|
from kivy.properties import StringProperty, NumericProperty
|
||||||
from kivy.uix.image import AsyncImage
|
from kivy.uix.image import AsyncImage
|
||||||
from .utils import *
|
from .utils import *
|
||||||
from .baseWidget import Modal, Text, HBox,VBox
|
from .baseWidget import Modal, Text, HBox,VBox
|
||||||
|
from .widget_css import register_css
|
||||||
|
from .clickable import ClickableIconText
|
||||||
from .toggleitems import PressableBox
|
from .toggleitems import PressableBox
|
||||||
|
|
||||||
|
conform_default_title_css = {
|
||||||
|
"bgcolor":[0.88,0.88,0.88,1],
|
||||||
|
"fgcolor":[0.12,0.12,0.12,1]
|
||||||
|
}
|
||||||
|
conform_default_body_css = {
|
||||||
|
"bgcolor":[0.92,0.92,0.92,1],
|
||||||
|
"fgcolor":[0.16,0.16,0.16,1]
|
||||||
|
}
|
||||||
|
|
||||||
|
conform_button_default_css = {
|
||||||
|
"bgcolor":[0.05,0.85,0.05,1],
|
||||||
|
"fgcolor":[0.95,0.95,0.95,1]
|
||||||
|
}
|
||||||
|
|
||||||
|
cancel_button_default_css = {
|
||||||
|
"bgcolor":[0.85, 0.5, 0.5, 1],
|
||||||
|
"fgcolor":[0.9, 0.90, 0.9, 1]
|
||||||
|
}
|
||||||
|
|
||||||
|
register_css('conform_default_title_css', conform_default_title_css)
|
||||||
|
register_css('conform_default_body_css', conform_default_body_css)
|
||||||
|
register_css('conform_button_default_css', conform_button_default_css)
|
||||||
|
register_css('cancel_button_default_css', cancel_button_default_css)
|
||||||
|
|
||||||
class Conform(Modal):
|
class Conform(Modal):
|
||||||
def __init__(self, title_icon=None,
|
title = StringProperty(None)
|
||||||
title = None,
|
title_icon = StringProperty(None)
|
||||||
message = None,
|
message = StringProperty(None)
|
||||||
conform_icon=None,
|
conform_icon = StringProperty(None)
|
||||||
cancel_icon=None,
|
cancel_icon = StringProperty(None)
|
||||||
**kw):
|
title_css = StringProperty('conform_default_title_css')
|
||||||
Modal.__init__(self, **kw)
|
body_css = StringProperty('conform_default_body_css')
|
||||||
|
conform_css = StringProperty('conform_button_default_css')
|
||||||
|
cancel_css = StringProperty('cancel_button_default_css')
|
||||||
|
def __init__(self, **kw):
|
||||||
|
super(Conform, self).__init__(**kw)
|
||||||
self.register_event_type('on_cancel')
|
self.register_event_type('on_cancel')
|
||||||
self.register_event_type('on_conform')
|
self.register_event_type('on_conform')
|
||||||
self.auto_dismiss = False
|
self.auto_dismiss = False
|
||||||
b = VBox()
|
b = VBox(csscls=self.title_css)
|
||||||
b1 = HBox(size_hint_y=None, height=CSize(1.4))
|
b1 = HBox(size_hint_y=None, height=CSize(2))
|
||||||
b1.add_widget(AsyncImage(source=title_icon or \
|
b1.add_widget(AsyncImage(source=self.title_icon or \
|
||||||
blockImage('question.png'),
|
blockImage('question.png'),
|
||||||
size_hint=[None,None],
|
size_hint=[None,None],
|
||||||
height=CSize(1.2),
|
height=CSize(1.2),
|
||||||
width=CSize(1.2)))
|
width=CSize(1.2)))
|
||||||
b1.add_widget(Text(text=title or 'Conform',
|
b1.add_widget(Text(otext=self.title or 'Conform',
|
||||||
font_size=CSize(1.2),
|
font_size=CSize(1.2),
|
||||||
i18n=True,
|
i18n=True,
|
||||||
wrap=True,
|
wrap=True,
|
||||||
@ -31,75 +62,43 @@ class Conform(Modal):
|
|||||||
valign='center',
|
valign='center',
|
||||||
))
|
))
|
||||||
b.add_widget(b1)
|
b.add_widget(b1)
|
||||||
b2 = HBox()
|
b2 = HBox(csscls=self.body_css)
|
||||||
|
|
||||||
b2.add_widget(Text(text=message or 'Please conform',
|
b2.add_widget(Text(text=self.message or 'Please conform',
|
||||||
|
i18n=True,
|
||||||
wrap=True,
|
wrap=True,
|
||||||
halign='left',
|
halign='left',
|
||||||
size_hint=(1,1),
|
size_hint=(1,1),
|
||||||
font_size=CSize(1)))
|
font_size=CSize(1)))
|
||||||
b.add_widget(b2)
|
b.add_widget(b2)
|
||||||
b3 = HBox(size_hint_y=None, height=CSize(2))
|
b3 = HBox(size_hint_y=None,
|
||||||
w_cancel = PressableBox()
|
height=CSize(2),
|
||||||
blocks = Factory.Blocks()
|
csscls=self.body_css)
|
||||||
w_cancel.add_widget(blocks.widgetBuild({
|
w_cancel = ClickableIconText(text='Cancel',
|
||||||
"widgettype":"HBox",
|
source=self.cancel_icon or
|
||||||
"options":{},
|
blockImage('cancel.png'),
|
||||||
"subwidgets":[
|
img_kw={
|
||||||
{
|
|
||||||
"widgettype":"AsyncImage",
|
|
||||||
"options":{
|
|
||||||
"source":cancel_icon or blockImage('cancel.png'),
|
|
||||||
"size_hint":[None, None],
|
"size_hint":[None, None],
|
||||||
"height":CSize(1),
|
"height":CSize(1),
|
||||||
"width":CSize(1)
|
"width":CSize(1)
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
csscls=self.cancel_css
|
||||||
"widgettype":"Text",
|
)
|
||||||
"options":{
|
w_conform = ClickableIconText(text='Conform',
|
||||||
"text":'Cancel',
|
source=self.conform_icon or
|
||||||
"wrap":True,
|
blockImage('question.png'),
|
||||||
"font_size":CSize(1),
|
img_kw={
|
||||||
"halign":'left',
|
|
||||||
"i18n":True
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}))
|
|
||||||
w_conform = PressableBox()
|
|
||||||
blocks = Factory.Blocks()
|
|
||||||
w_conform.add_widget(blocks.widgetBuild({
|
|
||||||
"widgettype":"HBox",
|
|
||||||
"options":{},
|
|
||||||
"subwidgets":[
|
|
||||||
{
|
|
||||||
"widgettype":"AsyncImage",
|
|
||||||
"options":{
|
|
||||||
"source":conform_icon or blockImage('conform.png'),
|
|
||||||
"size_hint":[None, None],
|
"size_hint":[None, None],
|
||||||
"height":CSize(1),
|
"height":CSize(1),
|
||||||
"width":CSize(1)
|
"width":CSize(1)
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
csscls=self.conform_css
|
||||||
"widgettype":"Text",
|
)
|
||||||
"options":{
|
|
||||||
"text":'Conform',
|
|
||||||
"wrap":True,
|
|
||||||
"font_size":CSize(1),
|
|
||||||
"halign":'left',
|
|
||||||
"i18n":True
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}))
|
|
||||||
|
|
||||||
w_cancel.bind(on_press=self.cancel_press)
|
w_cancel.bind(on_press=self.cancel_press)
|
||||||
w_conform.bind(on_press=self.conform_press)
|
w_conform.bind(on_press=self.conform_press)
|
||||||
|
|
||||||
b3.add_widget(w_cancel)
|
|
||||||
b3.add_widget(w_conform)
|
b3.add_widget(w_conform)
|
||||||
|
b3.add_widget(w_cancel)
|
||||||
b.add_widget(b3)
|
b.add_widget(b3)
|
||||||
self.add_widget(b)
|
self.add_widget(b)
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ from .ready import WidgetReady
|
|||||||
from .color_definitions import getColors
|
from .color_definitions import getColors
|
||||||
from .baseWidget import Text, Box
|
from .baseWidget import Text, Box
|
||||||
from .scrollpanel import ScrollPanel
|
from .scrollpanel import ScrollPanel
|
||||||
from .toggleitems import ToggleItems
|
from .command_action import cmd_action
|
||||||
|
|
||||||
class Toolbar(ScrollPanel):
|
class Toolbar(ScrollPanel):
|
||||||
"""
|
"""
|
||||||
@ -191,30 +191,11 @@ class Toolbar(ScrollPanel):
|
|||||||
self.dispatch('on_press', ret_v)
|
self.dispatch('on_press', ret_v)
|
||||||
return
|
return
|
||||||
|
|
||||||
blocks = Factory.Blocks()
|
desc = self.w_dic[o].copy()
|
||||||
desc = {
|
if not desc.get('target'):
|
||||||
}
|
desc['target'] = self.target
|
||||||
v = self.w_dic[o]
|
|
||||||
desc['target'] = v.get('target', self.target)
|
cmd_action(desc, self)
|
||||||
if v.get('datatarget'):
|
|
||||||
desc['datatarget'] = v.get('datatarget')
|
|
||||||
if v.get('datamethod'):
|
|
||||||
desc['datamethod'] = v['datamethod']
|
|
||||||
keys = v.keys()
|
|
||||||
if 'url' in keys:
|
|
||||||
desc['mode'] = 'replace'
|
|
||||||
options = {
|
|
||||||
'params':v.get('params',{}),
|
|
||||||
'url':v.get('url')
|
|
||||||
}
|
|
||||||
desc['options'] = options
|
|
||||||
Factory.Blocks().urlwidgetAction(self, desc)
|
|
||||||
if 'rfname' in keys:
|
|
||||||
desc['params'] = v.get('params',{})
|
|
||||||
Factory.Blocks().registedfunctionAction(self, desc)
|
|
||||||
if 'script' in keys:
|
|
||||||
desc['script'] = v.get('script')
|
|
||||||
Factory.Blocks().scriptAction(self, desc)
|
|
||||||
|
|
||||||
class ToolPage(Box):
|
class ToolPage(Box):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user