本文整理汇总了Python中thorpy.elements.element.Element类的典型用法代码示例。如果您正苦于以下问题:Python Element类的具体用法?Python Element怎么用?Python Element使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Element类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_size
def set_size(self, size, state=None, center_title=True, adapt_text=True,
cut=None, margins=style.MARGINS, refresh_title=False):
Element.set_size(self, size, state, center_title, adapt_text, cut, margins,
refresh_title)
if self._lift:
self.remove_elements([self._lift])
self.refresh_lift()
示例2: finish
def finish(self):
Element.finish(self)
(x, y) = self.is_family_bigger()
if (y and self._has_lift) or self._force_lift:
self.add_lift(typ="dv")
## self._lift.active_wheel = True
self._lift.active_wheel = False
示例3: __init__
def __init__(self,
size,
titles,
elements=None,
normal_params=None,
heavy=False,
folders=None,
margins=None,
has_lift=True):
margins = style.DDL_MARGINS if margins is None else margins
self._clicked = None
Element.__init__(self, elements=elements, normal_params=normal_params)
painter = functions.obtain_valid_painter(painterstyle.BOX_PAINTER,
pressed=True,
## color=style.DEF_COLOR2,
size=size,
radius=style.BOX_RADIUS)
self.set_painter(painter)
self._margins = margins
self._heavy = heavy
self._dv = self._get_dirviewer(titles, size, folders)
reac_motion= Reaction(MOUSEMOTION,
self._reaction_motion,
reac_name=constants.REAC_MOTION)
self.add_reaction(reac_motion)
self._cursor_pos = (-1, -1)
self._has_lift = has_lift
self._menu = None
self._set_selecter()
self._force_lift = False
示例4: finish
def finish(self):
Element.finish(self)
self._drag_element.set_center((None, self.get_fus_center()[1]))
for state in self._states:
self._states[state].refresh_ghost_rect()
self._setup()
self._drag_element.place_at(self.initial_value)
示例5: set_topleft
def set_topleft(self, pos, state=constants.STATE_NORMAL):
left, top = pos
w = self._states[state].fusionner.rect.width
zone = self.father._iwriter.get_zone()
if left + w > zone.right:
left = zone.right - w
Element.set_topleft(self, (left, top), state)
示例6: set_painter
def set_painter(self, painter, autopress=True):
"""To use before finish"""
Element.set_painter(self, painter)
if autopress:
painter = copy(painter)
painter.pressed = True
self.press_params.params["painter"] = painter
示例7: __init__
def __init__(self, nx, ny, cell_size):
Element.__init__(self)
self.grid = Grid(nx, ny, cell_size)
self.margins = style.MARGINS
self.current_coord = None
self.current_rect = None
reac_mousemotion = Reaction(pygame.MOUSEMOTION, self.func_mousemotion)
self.add_reaction(reac_mousemotion)
示例8: finish
def finish(self):
self._path_element._set_path_elements()
Element.finish(self)
self.store()
centerx = self.get_fus_rect().centerx
self.text_element.set_center((centerx, None))
ycoord = self._path_element._elements[0].get_storer_rect().centery
self._path_element._set_path_elements(ycoord)
self.set_prison()
示例9: finish
def finish(self):
Element.finish(self)
if self._size == "auto":
self.fit_children(only_children=False)
(x, y) = self.is_family_bigger()
if (y and self._has_lift) or self._force_lift:
self.add_lift(type_="dv")
## self._lift.active_wheel = True
self._lift.active_wheel = False
示例10: __init__
def __init__(self, target, color, elements=None, normal_params=None):
Element.__init__(self, "", elements, normal_params)
self.link(target)
self.shadow_radius = SHADOW_RADIUS
self.black = BLACK
self.alpha_factor = ALPHA_FACTOR
self.decay_mode = DECAY_MODE
self.capture_state = CAPTURE_STATE_STATIC
self.offset = OFFSET
self.color = color
示例11: finish
def finish(self):
Element.finish(self)
if not self._size:
self._size = self.get_fus_rect()
self.set_size(self._size)
for line in self.get_lines(STATE_NORMAL):
e = OneLineText(line)
e.finish()
e.set_writer(self.current_state.fusionner.title._writer)
self.add_elements([e])
self.format_txt()
示例12: make_text
def make_text(text, font_size=style.FONT_SIZE, font_color=style.FONT_COLOR):
params = {"font_color":font_color, "font_size":font_size}
button = Element(text, normal_params=params)
if not "\n" in text:
button.set_style("text")
button.finish()
if "\n" in text:
button.scale_to_title()
button.set_main_color((0,0,0,0))
return button
示例13: __init__
def __init__(self, length, limvals=None, text="", elements=None,
normal_params=None):
limvals = parameters.LIMVALS if limvals is None else limvals
self._plus = None
self._minus = None
Element.__init__(self, text, elements, normal_params)
_Slider.__init__(self, length, limvals)
self.current_state.autoghost = False
## self._set_wheel_reaction(parameters.BUTTON_UNPRESS_EVENT,
## {"button": parameters.WHEELUP_BUTTON})
## self._set_unwheel_reaction(parameters.BUTTON_PRESS_EVENT,
## {"button": parameters.WHEELDOWN_BUTTON})
self._setup()
self.active_wheel = False
示例14: __init__
def __init__(self, elements=None, normal_params=None, height=None):
Element.__init__(self, "", elements, normal_params)
h = max([e.get_storer_rect().height for e in self.get_elements()]) + 2
store(self, mode="h", x=1, y=h/2, align="center")
if self.father:
w = self.father.get_storer_rect().width
else:
w = functions.get_screen_size()[0]
size = (w, h)
painter = functions.obtain_valid_painter(painterstyle.BOX_PAINTER,
pressed=True,
size=size,
radius=style.BOX_RADIUS)
self.set_painter(painter)
示例15: __init__
def __init__(self, bartext="", elements=None, normal_params=None,
storer_params=None, size=None, put_lift=True):
Element.__init__(self, "", elements, normal_params)
self.storer_params = storer_params
if self.storer_params is None:
self.storer_params = dict()
self._size = size
self._has_lift = False
self._put_lift = put_lift
self._bartext = bartext
painter = functions.obtain_valid_painter(painterstyle.BOX_PAINTER,
pressed=True,
size=size,
radius=style.BOX_RADIUS)
self.set_painter(painter)