本文整理汇总了Python中thorpy.miscgui.functions.debug_msg函数的典型用法代码示例。如果您正苦于以下问题:Python debug_msg函数的具体用法?Python debug_msg怎么用?Python debug_msg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了debug_msg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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")
示例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()
示例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)
示例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()
示例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()
示例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()
示例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()
示例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)
示例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()
示例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!")
示例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)
示例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
示例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
示例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()
示例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))