当前位置: 首页>>代码示例>>Python>>正文


Python Graphics.add_uri方法代码示例

本文整理汇总了Python中graphics.Graphics.add_uri方法的典型用法代码示例。如果您正苦于以下问题:Python Graphics.add_uri方法的具体用法?Python Graphics.add_uri怎么用?Python Graphics.add_uri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在graphics.Graphics的用法示例。


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

示例1: get_graphics

# 需要导入模块: from graphics import Graphics [as 别名]
# 或者: from graphics.Graphics import add_uri [as 别名]
    def get_graphics(self):
        graphics = Graphics()

        email_address = self._task_master.read_task_data(EMAIL_UID)
        url = os.path.join(self._task_master.get_bundle_path(), 'html-content',
                           self._uri[0])
        graphics.add_uri('file://' + url, height=self._height)
        graphics.set_zoom_level(self._zoom_level)
        if email_address is not None:
            self._entry[0] = graphics.add_entry(text=email_address)
        else:
            self._entry[0] = graphics.add_entry()

        self._entry[0].connect('activate', self._enter_entered)

        phone_number = self._task_master.read_task_data(PHONE_NUMBER_UID)
        url = os.path.join(self._task_master.get_bundle_path(), 'html-content',
                           self._uri[1])
        graphics.add_uri('file://' + url, height=self._height)
        graphics.set_zoom_level(self._zoom_level)

        if phone_number is not None:
            self._entry[1] = graphics.add_entry(text=phone_number)
        else:
            self._entry[1] = graphics.add_entry()

        return graphics, self._prompt
开发者ID:cottonpaul,项目名称:OneSupport,代码行数:29,代码来源:tasks.py

示例2: _load_intro_graphics

# 需要导入模块: from graphics import Graphics [as 别名]
# 或者: from graphics.Graphics import add_uri [as 别名]
 def _load_intro_graphics(self, file_name='generic-problem.html',
                          message=None):
     center_in_panel = Gtk.Alignment.new(0.5, 0, 0, 0)
     url = os.path.join(self.bundle_path, 'html-content', file_name)
     graphics = Graphics()
     if message is None:
         graphics.add_uri('file://' + url)
     else:
         graphics.add_uri('file://' + url + '?MSG=' +
                          utils.get_safe_text(message))
     graphics.set_zoom_level(0.667)
     center_in_panel.add(graphics)
     graphics.show()
     self.set_canvas(center_in_panel)
     center_in_panel.show()
开发者ID:cottonpaul,项目名称:OneSupport,代码行数:17,代码来源:activity.py

示例3: Support5Task

# 需要导入模块: from graphics import Graphics [as 别名]
# 或者: from graphics.Graphics import add_uri [as 别名]

#.........这里部分代码省略.........
                button.destroy()
        elif len(self._results) < 10:
            for button in self._buttons:
                button.destroy()
            self._make_buttons(self._results)

    def _school_entry_press_cb(self, widget, event):
        if not self._is_valid_postal_code_entry():
            return
        self._results = self._completer.complete(
            widget.get_text() + Gdk.keyval_name(event.keyval), 0)

    def _yes_no_cb(self, widget, arg):
        if arg == 'yes':
            self._task_master.write_task_data(SCHOOL_UID, None)
            school = self._school_entry.get_text()
            postal_code = self._postal_code_entry.get_text()
            self._task_master.write_task_data(self.uid, self._task_data)
            self._task_master.write_task_data(SCHOOL_NAME, school)
            self._task_master.write_task_data(POST_CODE, postal_code)
            self._task_master.write_task_data(SCHOOL_UID, self._default_sf_id)
            self._task_master.current_task += 1
            self._task_master.write_task_data('current_task',
                                              self._task_master.current_task)
        self._task_master.task_master()

    def after_button_press(self):
        school = self._school_entry.get_text()
        if school in self._schools:
            i = self._schools.index(school)
            self._task_master.write_task_data(SCHOOL_UID, self._sf_ids[i])
            self._task_master.write_task_data(SCHOOL_NAME, school)
            return True
        else:
            # Confirm that it is OK to use a school not in the list.
            self._task_master.task_button.hide()
            self._graphics.add_text(_('Your school does not appear in our '
                                      'list of schools in Australia. '
                                      'OK to continue?'))
            self._graphics.add_yes_no_buttons(self._yes_no_cb)
            return False

    def get_graphics(self):
        self._graphics = Graphics()

        url = os.path.join(self._task_master.get_bundle_path(), 'html-content',
                           self._uri[0])
        self._graphics.add_uri('file://' + url, height=self._height)
        self._graphics.set_zoom_level(self._zoom_level)

        target = self._task_master.read_task_data(POST_CODE)
        if target is not None and \
           self._is_valid_postal_code_entry(target=target):
            self._postal_code_entry = self._graphics.add_entry(text=target)
        else:
            self._postal_code_entry = self._graphics.add_entry()

        self._postal_code_entry.connect('key-release-event',
                                        self._postal_code_entry_cb)
        self._postal_code_entry.connect('key-press-event',
                                        self._postal_code_entry_cb)
        self._postal_code_entry.connect('activate',
                                        self._postal_code_enter_entered)

        url = os.path.join(self._task_master.get_bundle_path(), 'html-content',
                           self._uri[1])
        self._graphics.add_uri('file://' + url, height=self._height)
        self._graphics.set_zoom_level(self._zoom_level)

        target = self._task_master.read_task_data(SCHOOL_NAME)
        if target is not None:
            self._school_entry = self._graphics.add_entry(text=target)
        else:
            self._school_entry = self._graphics.add_entry()

        self._school_entry.connect('key-release-event',
                                   self._school_entry_release_cb)
        self._school_entry.connect('key-press-event',
                                   self._school_entry_press_cb)
        self._school_entry.connect('focus-in-event',
                                   self._school_entry_focus_cb)
        self._school_entry.connect('activate', self._school_enter_entered)

        self._postal_code_entry.grab_focus()

        return self._graphics, self._prompt

    def grab_focus(self):
        self._postal_code_entry.set_can_focus(True)
        self._school_entry.set_can_focus(True)
        if len(self._postal_code_entry.get_text()) < 3:
            self._task_master.activity.set_copy_widget(
                text_entry=self._postal_code_entry)
            self._task_master.activity.set_paste_widget(
                text_entry=self._postal_code_entry)
        else:
            self._task_master.activity.set_copy_widget(
                text_entry=self._school_entry)
            self._task_master.activity.set_paste_widget(
                text_entry=self._school_entry)
开发者ID:cottonpaul,项目名称:OneSupport,代码行数:104,代码来源:tasks.py


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