本文整理汇总了Python中thorpy.miscgui.functions.debug_msg函数的典型用法代码示例。如果您正苦于以下问题:Python debug_msg函数的具体用法?Python debug_msg怎么用?Python debug_msg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug_msg函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: set_painter
def set_painter(self, painter, state=None, autopress=True):
"""Use before finish. If not, use set_active_painter instead."""
self.normal_params.params["painter"] = painter
if self._finished:
self.change_painter(painter, state, autopress)
functions.debug_msg("Attention, this element is not finished : " +
str(self) + ". Use set_active_painter instead")
开发者ID:YannThorimbert,项目名称:ThorPy-1.4.1,代码行数:7,代码来源:element.py
示例2: set_size
def set_size(self, size, state=None, center_title=True, adapt_text=True,
cut=None, margins=style.MARGINS, refresh_title=False):
"""<margins> is used for text cutting only."""
if state is None:
for state in self._states:
self.set_size(size, state, center_title, adapt_text, cut,
margins)
else:
try:
if size[0] is None:
sizex = self._states[state].fusionner.painter.size[0]
else:
sizex = size[0]
if size[1] is None:
sizey = self._states[state].fusionner.painter.size[1]
else:
sizey = size[1]
size = (sizex, sizey)
self._states[state].fusionner.painter.set_size(size)
if adapt_text:
txt_size = (size[0] - 2 * margins[0],
size[1] - 2 * margins[1])
self.set_text(self._states[state].fusionner.title._text,
state, center_title, txt_size, cut)
refresh_title = False
self.redraw(state, refresh_title=refresh_title)
except AttributeError:
functions.debug_msg(
"Impossible to change Element's size: " +
str(self) +
"\n State: " +
str(state))
if self._lift:
self.refresh_lift()
开发者ID:YannThorimbert,项目名称:ThorPy-1.4.1,代码行数:34,代码来源:element.py
示例3: get_fusion
def get_fusion(self, title, center_title):
"""Fusion the painter.img and the title.img and returns this fusion"""
if title._writer.color == self.color:
functions.debug_msg("Colorkey is the same as writer's color while\
generating " + title._text)
if center_title is True: # center the title on the element rect
title.center_on(self.size)
elif center_title is not False: # center_title is the topleft argument
title._pos = center_title
else:
title._pos = (0, 0)
painter_img = self.get_surface()
old_aa = title._writer.aa
old_imgs = title._imgs
if old_aa:
title._writer.aa = False
title.refresh_imgs()
title.blit_on(painter_img)
if old_aa:
title._writer.aa = True
title._imgs = old_imgs
functions.debug_msg("Building illuminer of size " + str(self.size))
return illuminate_alphacolor_except(painter_img, self.color,
self.color_target, self.color_bulk,
self.subrect, self.factor,
self.fadout, self.bulk_alpha)
开发者ID:YannThorimbert,项目名称:Thorpy-1.5.2a,代码行数:26,代码来源:illuminer.py
示例4: _reaction_keydown
def _reaction_keydown(self, pygame_event):
if self._activated:
if pygame_event.type == KEYDOWN:
if pygame_event.key == K_ESCAPE:
self.exit()
elif pygame_event.key == K_RETURN: # way to exit saving insertion
self._value = self._inserted
self.exit()
functions.debug_msg("'" + self._inserted + "'", " inserted")
elif pygame_event.key == K_BACKSPACE:
if self._cursor_index > 0:
before = self._inserted[0:self._cursor_index-1]
after = self._inserted[self._cursor_index:]
self._inserted = before + after
self._cursor_index -= 1
self._urbu()
# if this is a modifier, the next char will be handled by the
# keyer...
elif pygame_event.key == K_LEFT:
if self._cursor_index > 1:
self._cursor_index -= 1
self._urbu()
elif pygame_event.key == K_RIGHT:
if self._cursor_index < len(self._inserted):
self._cursor_index += 1
self._urbu()
elif not pygame_event.key in self._keyer.modifiers:
char = self._keyer.get_char_from_key(pygame_event.key)
before = self._inserted[0:self._cursor_index]
after = self._inserted[self._cursor_index:]
new_word = before + char + after
if self._iwriter._is_small_enough(new_word):
self._inserted = new_word
self._cursor_index += 1
self._urbu()
开发者ID:YannThorimbert,项目名称:ThorPy-1.4.1,代码行数:35,代码来源:inserter.py
示例5: redraw
def redraw(self, state=None, painter=None, title=None, refresh_title=False):
if state is None:
for state in self._states:
self.redraw(state, painter, title, refresh_title)
else:
if painter:
try:
self._states[state].fusionner.painter = painter
except AttributeError:
functions.debug_msg(
"Impossible to change Element's painter: " +
str(self) +
" in state: " +
str(state))
if title:
try:
self._states[state].fusionner.title = title
refresh_title = True
except AttributeError:
functions.debug_msg(
"Impossible to change Element's title: " +
str(self) +
" in state: " +
str(state))
self._states[state].fusionner.refresh(refresh_title=refresh_title)
self._states[state].refresh_ghost_rect()
开发者ID:YannThorimbert,项目名称:ThorPy-1.4.1,代码行数:26,代码来源:element.py
示例6: finish_population
def finish_population(self):
"""Control that all elements have been finished"""
for e in self.population:
if not(e._finished):
functions.debug_msg(str(e) + " was not _finished !\
Automatic finish.")
e.finish()
开发者ID:YannThorimbert,项目名称:Thorpy-1.5.2a,代码行数:7,代码来源:basicmenu.py
示例7: get_value
def get_value(self):
try:
return self._value_type(self._inserted)
except ValueError:
functions.debug_msg("type of self._inserted is not " + \
str(self._value_type))
return self._value_type()
开发者ID:YannThorimbert,项目名称:ThorPy-1.4.1,代码行数:7,代码来源:inserter.py
示例8: add_reaction
def add_reaction(self, reaction, index=None):
"""If reaction's name is not None and already exists in self._reactions,
it will be replaced. Otherwise the reaction is appended to
self._reactions.
Remember : if you want the changes to affect the current menu,
call thorpy.functions.refresh_current_menu().
"""
if reaction.reac_name is None:
self._reactions.append(reaction)
else:
index_reaction = None
for (i, r) in enumerate(self._reactions):
if r.reac_name == reaction.reac_name:
functions.debug_msg("Reaction conflict:", r.reac_name)
index_reaction = i
break
if index_reaction is None:
self._reactions.append(reaction)
else:
self._reactions[index_reaction] = reaction
if index:
if index == -1:
index = len(self._reactions)
self.set_reaction_index(index, reaction)
开发者ID:YannThorimbert,项目名称:Thorpy-1.5.2a,代码行数:25,代码来源:ghost.py
示例9: get_surface
def get_surface(self):
W, H = functions.get_screen_size()
if isinstance(self.img_path, str): # load image
surface = load_image(self.img_path)
else: # take image
surface = self.img_path
if 0 < self.alpha < 255:
surface.set_alpha(self.alpha, RLEACCEL)
if self.mode == "scale to screen":
surface = scale(surface, (W, H))
self.size = (W, H)
elif self.mode == "cut to screen":
new_surface = Surface((W, H))
new_surface.blit(surface, (0, 0))
self.size = (W, H)
elif self._resized:
surface = scale(surface, self._resized)
elif self.mode:
functions.debug_msg("Unrecognized mode : ", self.mode)
## elif self._resized:
## surface = scale(surface, self._resized)
if self.colorkey:
surface.set_colorkey(self.colorkey, RLEACCEL)
surface.set_clip(self.clip)
if self.alpha < 255:
return surface.convert_alpha()
else:
return surface.convert()
开发者ID:YannThorimbert,项目名称:ThorPy-1.0,代码行数:28,代码来源:imageframe.py
示例10: remove_from_current_menu
def remove_from_current_menu(self):
menu = functions.get_current_menu()
if self.launched in menu.get_population():
menu.remove_from_population(self.launched)
else:
functions.debug_msg("The launched element of the launcher has been\
removed from the current menu by another element!")
开发者ID:YannThorimbert,项目名称:Thorpy-1.5.2a,代码行数:7,代码来源:launcher.py
示例11: save_screenshot
def save_screenshot(self, path=None, name=None, note=""):
from thorpy.miscgui import functions
if path is None:
path = self.default_path
if name is None:
name = time.asctime().replace(" ", "_").replace(":", "-") + ".png"
functions.debug_msg("Saving screenshot as " + path + note + name)
pygame.image.save(functions.get_screen(), path+note+name)
开发者ID:YannThorimbert,项目名称:Thorpy-1.5.2a,代码行数:8,代码来源:application.py
示例12: enter
def enter(self):
functions.debug_msg("Entering inserter ", self)
if self.repeat_delay is not None:
key_set_repeat(self.repeat_delay, self.repeat_interval)
if self._hide_mouse:
mouse_set_visible(False)
self._activated = True
self.cursor._activated = True
开发者ID:YannThorimbert,项目名称:ThorPy-1.4.1,代码行数:8,代码来源:inserter.py
示例13: shift
def shift(self, sign=1):
sign = -sign
if self.is_and_will_be_inside(sign):
self.dragmove(sign)
current_value = self.slider.get_value()
delta = self.last_value - current_value
shift_y = 1 * delta
self.slider._linked.scroll_children([self.slider], (0, shift_y))
functions.debug_msg("Lift value : ", current_value)
self.last_value = current_value
开发者ID:YannThorimbert,项目名称:ThorPy-1.4.2,代码行数:10,代码来源:_dragger.py
示例14: _deny_child
def _deny_child(self, child):
"""The difference with a normal element remove is that the child
continues to see its father, though its father doesn't see it anymore.
"""
if child.father is not self and child.father is not None:
functions.debug_msg("Attention, stealing child" + str(child) +\
" from " + str(child.father) + " to "+str(self))
child.father = self
while child in self.get_elements():
self.remove_elements([child])
assert child not in self.get_elements()
开发者ID:YannThorimbert,项目名称:ThorPy-1.4.1,代码行数:11,代码来源:ghost.py
示例15: set_main_color
def set_main_color(self, color, state=None):
if state is None:
for state in self._states:
self.set_main_color(color, state)
else:
try:
self._states[state].fusionner.painter.set_color(color)
self.redraw(state)
except AttributeError:
functions.debug_msg(
"Impossible to change Element's main color: ", self,
"\n State: " + str(state))
开发者ID:YannThorimbert,项目名称:ThorPy-1.4.1,代码行数:12,代码来源:element.py
示例16: add_lift
def add_lift(self, axis="vertical", typ="normal"):
if typ == "normal":
from thorpy.elements.lift import LiftY
lift_typ = LiftY
elif typ == "dv":
from thorpy.elements.lift import LiftDirViewerY
lift_typ = LiftDirViewerY
if axis == "vertical":
lift = lift_typ(self) # lift is already finished
self.add_elements([lift])
self._lift = lift # to access easily to the lift
else:
functions.debug_msg("Only vertical lift is available.")
开发者ID:YannThorimbert,项目名称:ThorPy-1.4.1,代码行数:13,代码来源:element.py
示例17: _get_folders_and_files
def _get_folders_and_files(self):
try:
titles = listdir(self.path)
except WindowsError:
functions.debug_msg("Access denied to this folder/file. Try running\
the script as administrator.")
return [], []
folders = []
files = []
for title in titles:
if isdir(self.path + title + "/"):
folders.append(title)
else:
files.append(title)
return folders, files
开发者ID:YannThorimbert,项目名称:Thorpy-1.5.2a,代码行数:15,代码来源:browserlight.py
示例18: finish
def finish(self):
Clickable.finish(self)
# cursor is initialized in finish because _iwriter needs self.fusionner
# to initialize...
self.make_small_enough(self._inserted)
if not self._iwriter._is_small_enough(self._inserted):
functions.debug_msg("Inserter is too small for value", self._inserted)
if self.auto_resize:
self.set_size(self._iwriter.get_rect().inflate((2,2)).size)
self._iwriter.refresh_img()
self.cursor = _Cursor(self)
self.add_elements(list([self.cursor]))
self._refresh_pos()
self.cursor.finish()
self._name_element.user_func = self.enter
开发者ID:YannThorimbert,项目名称:Thorpy-1.5.2a,代码行数:15,代码来源:inserter.py
示例19: draw
def draw(self):
if len(self.color) == 3 or self.color[-1] == 255:
if self.size[0] < 1:
debug_msg("Width < 1, automatic resize.", self)
self.size = (1, self.size[1])
if self.size[1] < 1:
debug_msg("Height < 1, automatic resize.", self)
self.size = (self.size[0], 1)
surface = Surface(self.size).convert()
elif len(self.color) == 4:
surface = Surface(self.size, flags=SRCALPHA).convert_alpha()
else:
raise Exception("Invalid color attribut")
surface.fill(self.color)
return surface
开发者ID:YannThorimbert,项目名称:ThorPy-1.0,代码行数:15,代码来源:basicframe.py
示例20: exit
def exit(self):
key_set_repeat(parameters.KEY_DELAY, parameters.KEY_INTERVAL)
if self._activated:
functions.debug_msg("Leaving inserter ", self)
self._inserted = self._value
self._urbu()
mouse_set_visible(True)
self.cursor.exit()
self._activated = False
event_quit = event.Event(constants.THORPY_EVENT,
id=constants.EVENT_INSERT,
el=self,
value=self._value)
event.post(event_quit)
if self._varlink_func:
self._varlink_func(self._value)
开发者ID:YannThorimbert,项目名称:ThorPy-1.4.1,代码行数:16,代码来源:inserter.py
注:本文中的thorpy.miscgui.functions.debug_msg函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论