• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python functions.obtain_valid_painter函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中thorpy.miscgui.functions.obtain_valid_painter函数的典型用法代码示例。如果您正苦于以下问题:Python obtain_valid_painter函数的具体用法?Python obtain_valid_painter怎么用?Python obtain_valid_painter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了obtain_valid_painter函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: _setup

 def _setup(self, height=None, dragsize=None):
     height = style.SLIDER_THICK if height is None else height
     dragsize = style.SLIDERX_DRAG_SIZE if dragsize is None else dragsize
     self._height = height
     size = (self._length + dragsize[0] + style.SLIDER_MARGINS[0], height)
     painter = functions.obtain_valid_painter(
         painterstyle.DEF_PAINTER,
         pressed=True,
         color=style.DEF_COLOR2,
         size=size)
     self.set_painter(painter)
     dp = functions.obtain_valid_painter(
         painterstyle.DEF_PAINTER,
         pressed=False,
         size=dragsize)
     try:
         drag_x = self.val_to_pix(self.initial_value,
                                  self.get_fus_topleft()[0]) + 1
         self._drag_element.change_painter(dp, autopress=False)
         self._drag_element.set_center((drag_x, self.get_fus_center()[1]))
     except AttributeError:
         drag_x = self.val_to_pix(self.initial_value,
                                  self.get_ghost_topleft()[0]) + 1
         self._drag_element.set_painter(dp, autopress=False)
         self._drag_element.set_center((drag_x, self.get_ghost_center()[1]))
     self._drag_element.set_free(y=False)
     self.englobe_childrens()
开发者ID:YannThorimbert,项目名称:ThorPy-1.4.1,代码行数:27,代码来源:slider.py


示例2: _gen_painter

 def _gen_painter(self):
     if self._type == "checkbox":
         return functions.obtain_valid_painter(
             painterstyle.CHECKBOX_PAINTER,
             color=style.DEF_COLOR2,
             size=style.CHECK_SIZE,
             pressed=True)
     elif self._type == "radio":
         return functions.obtain_valid_painter(
             painterstyle.RADIO_PAINTER,
             size=style.CHECK_SIZE, pressed=True)
开发者ID:YannThorimbert,项目名称:ThorPy-1.4.2,代码行数:11,代码来源:checker.py


示例3: set_standard_style

 def set_standard_style(self):
     from thorpy.painting.fusionner import _Fusionner
     for e in self.get_elements():
         painter = functions.obtain_valid_painter(painterstyle.BASIC_PAINTER,
                                 size=e.get_fus_rect().size)
         fusionner = _Fusionner(painter, e.get_title())
         e.set_image(fusionner.img)
开发者ID:YannThorimbert,项目名称:ThorPy-1.4.3,代码行数:7,代码来源:box.py


示例4: __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
开发者ID:YannThorimbert,项目名称:ThorPy-1.4.1,代码行数:30,代码来源:ddlf.py


示例5: _setup

 def _setup(self, width=style.LIFT_BUTTON_SIZE[0],
           dragsize=style.LIFT_DRAG_SIZE):
     self._drag_element = DraggerLiftY(self)
     self._height = width
     painter = functions.obtain_valid_painter(
         painterstyle.DEF_PAINTER,
         pressed=True,
         color=style.DEF_COLOR2,
         size=(
             width,
             self._length +
             dragsize[1] +
             style.LIFT_MARGINS[1] +
             1))
     self.set_painter(painter)
     self._drag_element.set_painter(
         painterstyle.DEF_PAINTER(
             size=dragsize),
         autopress=False)
     try:
         self._drag_element.set_center((self.get_fus_center()[0], None))
     except AttributeError:  # state is ghost state, and has no fusionner
         self._drag_element.set_center((self.get_ghost_center()[0], None))
     self._drag_element.set_free(y=False)
     self.englobe_childrens()
开发者ID:YannThorimbert,项目名称:ThorPy-1.4.1,代码行数:25,代码来源:lift.py


示例6: _get_name_element

 def _get_name_element(self, name):
     painter = functions.obtain_valid_painter(painterstyle.DEF_PAINTER,
                                              size=style.SIZE)
     el = Clickable(name)
     el.set_painter(painter)
     el.finish()
     return el
开发者ID:YannThorimbert,项目名称:ThorPy-1.0,代码行数:7,代码来源:boxlauncher.py


示例7: _get_file_element

 def _get_file_element(self, name):
     painter = functions.obtain_valid_painter(painterstyle.NAME_PAINTER,
                                              size=style.SIZE)
     el = Element(name)
     el.set_painter(painter)
     el.set_style(style.STYLE_NAME)
     el.finish()
     return el
开发者ID:YannThorimbert,项目名称:ThorPy-1.4.2,代码行数:8,代码来源:browserlauncher.py


示例8: __init__

    def __init__(self,
                 path="./",
                 ddl_size=None,
                 normal_params=None,
                 folders=True,
                 files=True,
                 file_types=None,
                 text=""):
        """File and folder browser.
        <path>: the path of the folder in which browser browse files.
        <ddl_size>: if not None, force the size of the dropdown list of files.
        <folders>: if True, displays folders to user.
        <files>: if True, displays file to user.
        <file_types>: if not None, pass a list of files formats that you wand to
            be valid for user choice.
        <text>: title text of the browser.
        """
        ddl_size = style.BROWSERLIGHT_DDL_SIZE if ddl_size is None else ddl_size
        super(BrowserLight, self).__init__(normal_params=normal_params)
        self.path = path
        self._ddl_size = ddl_size
        if not hasattr(file_types, "__iter__") and file_types is not None:
            raise ValueError("Files types must be a sequence.")
        self.file_types = file_types
        # DropDownListFast
        actual_folders, actual_files = self._get_folders_and_files()
        actual_files = self._filter_files(actual_files)
        if not folders:
            actual_folders = None
        if not files:
            actual_files = []
        self._ddlf = DropDownListFast(size=self._ddl_size, titles=actual_files,
                                      folders=actual_folders)
        # selection button
        inserter_width = 3 * ddl_size[0] // 4
##        if inserter_width > style.MAX_INSERTER_WIDTH:
##            inserter_width = style.MAX_INSERTER_WIDTH
        self._selected = Inserter("Selected : ", size=(inserter_width, None))
        self._selected.finish()
        if isinstance(text, str):
            self.text_element = OneLineText(text)
            self.text_element.finish()
        else:
            self.text_element = text
        self.add_elements([self.text_element, self._ddlf, self._selected])
        reac_pressed = Reaction(parameters.BUTTON_UNPRESS_EVENT,
                                self._reaction_press,
                                reac_name=constants.REAC_PRESSED)
        self._ddlf.finish()
        self.add_reaction(reac_pressed)
        self._clicked = None
        self._something_selected = False
        painter = functions.obtain_valid_painter(painterstyle.BOX_PAINTER,
                                                 pressed=True,
##                                                 color=style.DEF_COLOR2,
                                                 radius=style.BOX_RADIUS)
        self.set_painter(painter)
        self._refresh_ddlf_lift()
开发者ID:YannThorimbert,项目名称:Thorpy-1.5.2a,代码行数:58,代码来源:browserlight.py


示例9: _get_value_element

 def _get_value_element(self, valuestyle):
     painter = functions.obtain_valid_painter(
         painterstyle.CHECKER_VALUE_PAINTER,
         size=style.CHECK_SIZE)
     el = Element(str(self.get_value()))
     el.set_painter(painter)
     if valuestyle:
         el.set_style(valuestyle)
     el.finish()
     return el
开发者ID:YannThorimbert,项目名称:ThorPy-1.0,代码行数:10,代码来源:slidersetter.py


示例10: _get_name_element

 def _get_name_element(self, name, namestyle):
     painter = functions.obtain_valid_painter(
         painterstyle.INSERTER_NAME_PAINTER,
         size=style.SIZE)
     el = Clickable(name)
     el.set_painter(painter)
     if namestyle:
         el.set_style(namestyle)
     el.finish()
     return el
开发者ID:YannThorimbert,项目名称:ThorPy-1.4.1,代码行数:10,代码来源:inserter.py


示例11: get_launcher_element

 def get_launcher_element(self, name):
     size = (style.SIZE[0], style.Y_SMALL_SIZE)
     painter = functions.obtain_valid_painter(
         painterstyle.BROWSER_LAUNCHER_PAINTER,
         size=size)
     el = Clickable(name)
     el.set_painter(painter)
     el.set_style(style.STYLE_BROWSER_LAUNCHER)
     el.finish()
     return el
开发者ID:YannThorimbert,项目名称:ThorPy-1.4.2,代码行数:10,代码来源:browserlauncher.py


示例12: __init__

 def __init__(self,
              name="",
              elements=None,
              normal_params=None,
              press_params=None,
              value="",
              size=(None, None),
              namestyle=None,
              varlink_func=None,
              quit_on_click=False,
              value_type=str):
     """<to_set> : either None or a function which must take one argument"""
     namestyle=style.STYLE_INSERTER_NAME if namestyle is None else namestyle
     if size[0] is None:
         s0 = style.SIZE[0]
     else:
         s0 = size[0]
     if size[1] is None:
         s1 = style.Y_SMALL_SIZE
     else:
         s1 = size[1]
     size = (s0, s1)
     self.cursor = None
     super(Inserter, self).__init__("", elements, normal_params,
                                    press_params)
     self._name_element = self._get_name_element(name, namestyle)
     self.add_elements([self._name_element])
     self._iwriter = _InsertWriter(value)
     self._iwriter.finish()
     self.add_elements([self._iwriter])
     self.quit_on_click = quit_on_click
     self._value_type = value_type
     painter = functions.obtain_valid_painter(painterstyle.INSERTER_PAINTER,
                                              color=style.DEF_COLOR2,
                                              pressed=True,
                                              size=(s0,s1))
     self.set_painter(painter)
     self.normal_params.polite_set("states hover",
                                   [constants.STATE_NORMAL,
                                    constants.STATE_PRESSED])
     self.press_params.polite_set("states hover",
                                  [constants.STATE_NORMAL,
                                   constants.STATE_PRESSED])
     self._activated = False
     self._value = value
     self._inserted = self._value
     self._cursor_index = len(self._inserted)
     reac_keypress = Reaction(KEYDOWN, self._reaction_keydown,
                              reac_name=constants.REAC_KEYPRESS)
     self.add_reaction(reac_keypress)
     self._keyer = Keyer()
     self._hide_mouse = self.normal_params.params.get("hide mouse", False)
     self._varlink_func = varlink_func
     self.repeat_delay = parameters.KEY_DELAY
     self.repeat_interval = parameters.KEY_INTERVAL
开发者ID:YannThorimbert,项目名称:ThorPy-1.4.1,代码行数:55,代码来源:inserter.py


示例13: __init__

    def __init__(self,
                 path="./",
                 ddl_size=None,
                 normal_params=None,
                 folders=True,
                 files=True,
                 file_types=None,
                 text=""):
        ddl_size = style.BROWSERLIGHT_DDL_SIZE if ddl_size is None else ddl_size
        super(BrowserLight, self).__init__(normal_params=normal_params)
        self.path = path
        self._ddl_size = ddl_size
        self.file_types = file_types
        self.folders = folders
        self.files = files
        # DropDownListFast
        actual_folders, actual_files = self._get_folders_and_files()
        actual_files = self._filter_files(actual_files)
        if not folders:
            actual_folders = None
        if not files:
            actual_files = []
        self._ddlf = DropDownListFast(self._ddl_size, titles=actual_files,
                                      folders=actual_folders, has_lift=True)
##        self._ddlf.finish()
        # selection button
        inserter_width = 3*ddl_size[0]//4
##        if inserter_width > style.MAX_INSERTER_WIDTH:
##            inserter_width = style.MAX_INSERTER_WIDTH
        self._selected = Inserter("Selected : ", size=(inserter_width, None))
        self._selected.finish()
        if isinstance(text, str):
            self.text_element = OneLineText(text)
            self.text_element.finish()
        else:
            self.text_element = text
        self._path_element = PathElement(self, True)
        self._path_element.finish()
        self.add_elements([self.text_element, self._path_element, self._ddlf,
                           self._selected])
        reac_pressed = Reaction(parameters.BUTTON_UNPRESS_EVENT,
                                self._reaction_press,
                                name=constants.REAC_PRESSED)
##        self._ddlf._force_lift = True
        self._ddlf.finish()
        self.add_reaction(reac_pressed)
        self._clicked = None
        self._something_selected = False
        painter = functions.obtain_valid_painter(painterstyle.BOX_PAINTER,
                                                 pressed=True,
                                                 radius=style.BOX_RADIUS)
        self.set_painter(painter)
        self._last_click = -2 * parameters.DOUBLE_CLICK_DELAY
开发者ID:YannThorimbert,项目名称:ThorPy-1.0,代码行数:53,代码来源:browser.py


示例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)
开发者ID:YannThorimbert,项目名称:ThorPy-1.4.3,代码行数:14,代码来源:box.py


示例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)
开发者ID:YannThorimbert,项目名称:ThorPy-1.4.2,代码行数:15,代码来源:box.py


示例16: _get_example_element

 def _get_example_element(self):
     color = self.get_color()
     painter_frame = functions.obtain_valid_painter(painterstyle.DEF_PAINTER,
                                                    pressed=True,
                                                    size=self._color_size)
     if painter_frame.clip:
         color_size = painter_frame.clip.size
     else:
         color_size = self._color_size
     painter_example = BasicFrame(size=color_size, color=color)
     example = Element()
     example.set_painter(painter_example)
     example.finish()
     frame = Element(elements=[example])
     frame.set_painter(painter_frame)
     frame.finish()
     example.set_center(frame.get_fus_center())
     return frame
开发者ID:YannThorimbert,项目名称:ThorPy-1.0,代码行数:18,代码来源:colorsetter.py


示例17: add_bar

    def add_bar(self, text="", size=None, painter=None):
        writer = painterstyle.WRITER(font_name=style.BAR_FONTS,
                                     color=style.FONT_BAR_COLOR,
                                     size=style.FONT_BAR_SIZE,
                                     italic=style.BAR_ITALIC,
                                     bold=style.BAR_BOLD,
                                     underline=style.BAR_UNDERLINE,
                                     aa=style.FONT_BAR_AA,
                                     bckgr_color=style.FONT_BAR_BCKGR)

        params = {"writer": writer}
        bar = Element(text=text, normal_params=params)
        if not painter:
            painter = functions.obtain_valid_painter(painterstyle.BAR_PAINTER,
                                                     color=style.BAR_COLOR)
        bar.set_painter(painter)
        bar.finish()
        if size:
            bar.set_size(size)
        bar.set_bar_of(self)
开发者ID:YannThorimbert,项目名称:ThorPy-1.4.1,代码行数:20,代码来源:element.py


示例18: __init__

    def __init__(self,
                 titles,
                 size="auto",
                 elements=None,
                 normal_params=None,
                 heavy=False,
                 folders=None,
                 margins=None,
                 x=None,
                 has_lift=True):
        """Vertical list of multiple texts that can be selected.
        <titles>: a list of strings containing the different choices to display.
        <heavy>: if True, use more memory but is faster.
        <margins>: the margins of the dropdown list, not taking <x> into
            account.
        <x>: the value at which text starts. If x = 0, folders image will be
        croped!
        """
        margins = style.DDL_MARGINS if margins is None else margins
        size_painter = style.DDL_SIZE if size == "auto" else size
        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_painter,
                                                 radius=style.BOX_RADIUS)
        self.set_painter(painter)
        self._margins = margins
        self._heavy = heavy
        self._dv = self._get_dirviewer(titles, size_painter, folders, x)
        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
        self._size = size
开发者ID:YannThorimbert,项目名称:Thorpy-1.5.2a,代码行数:41,代码来源:ddlf.py


示例19: _setup

 def _setup(self, width=None, dragsize=None):
     width = style.LIFT_BUTTON_SIZE[0] if width is None else width
     dragsize = style.LIFT_DRAG_SIZE if dragsize is None else dragsize
     self._drag_element = DraggerDirViewerY(self)
     self._height = width
     painter = functions.obtain_valid_painter(
         painterstyle.DEF_PAINTER,
         color=style.DEF_COLOR2,
         pressed=True,
         size=(width,
               self._length + dragsize[1] + style.LIFT_MARGINS[1] + 1))
     self.set_painter(painter)
     self._drag_element.set_painter(painterstyle.DEF_PAINTER(size=dragsize),
                                    autopress=False)
     self.current_state.ghost_rect.height = self._length
     try:
         self._drag_element.set_center((self.get_fus_center()[0], None))
     except AttributeError:  # state is ghost state, and has no fusionner
         self._drag_element.set_center((self.get_ghost_center()[0], None))
     self._drag_element.set_free(y=False)
     Ghost.fit_children(self)
开发者ID:YannThorimbert,项目名称:Thorpy-1.5.2a,代码行数:21,代码来源:lift.py


示例20: get_fusionner

 def get_fusionner(self):
     if "fusionner" in self.params:
         return self.params["fusionner"]
     else:
         painter = self.get_painter()
         title = self.get_title()
         colorkey = self.params.get("colorkey")
         params = {"painter": painter, "title": title,
                   "colorkey": colorkey}
         typ = self.params.get("style")
         if typ == "text":
             params.pop("painter")
             fusionner = _get_generic_object(FusionnerText, params)
             return fusionner
         elif typ == "help":
             pain = functions.obtain_valid_painter(painterstyle.HELP_PAINTER,
                                                   size=style.HELP_SIZE,
                                                   color=style.DEF_HELP_COLOR)
             params["painter"] = self.get_painter(pain)
         elif typ == "normal":
             pass
         elif typ:
             functions.debug_msg("Unknown style : " + str(typ))
         return _get_generic_object(_Fusionner, params)
开发者ID:YannThorimbert,项目名称:ThorPy-1.0,代码行数:24,代码来源:initializer.py



注:本文中的thorpy.miscgui.functions.obtain_valid_painter函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python thread._count函数代码示例发布时间:2022-05-27
下一篇:
Python functions.debug_msg函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap