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


Python BasicDialog.set_transient_for方法代码示例

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


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

示例1: BaseEditor

# 需要导入模块: from stoqlib.gui.base.dialogs import BasicDialog [as 别名]
# 或者: from stoqlib.gui.base.dialogs.BasicDialog import set_transient_for [as 别名]

#.........这里部分代码省略.........
        self.retval = False
        BaseEditorSlave.cancel(self)

        self.main_dialog.close()
        if isinstance(self.store, StoqlibStore):
            self.store.retval = self.retval

        log.info("%s: Closed (cancelled), retval=%r" % (
            self.__class__.__name__, self.retval))

    def confirm(self):
        """
        Confirm the dialog.
        """
        # set this before runing BaseEditorSlave.confirm so
        # on_confirm can modify self.retval, if needed
        self.retval = self.model

        if self._confirm_disabled:
            return False
        if not BaseEditorSlave.confirm(self):
            return False

        self.main_dialog.close()
        if isinstance(self.store, StoqlibStore):
            self.store.retval = self.retval

        log.info("%s: Closed (confirmed), retval=%r" % (
            self.__class__.__name__, self.retval))

        return True

    def enable_ok(self):
        """
        Enable the ok button of the dialog, eg makes it possible
        to close/confirm the dialog.
        """
        self.main_dialog.enable_ok()
        self._confirm_disabled = False

    def disable_ok(self):
        """
        Enable the ok button of the dialog, eg makes it possible
        to close/confirm the dialog.
        """
        self.main_dialog.disable_ok()
        self._confirm_disabled = True

    def enable_normal_window(self):
        """
        Enable the dialog as a normal window.
        This tells the window manager that the window
        should behave as a normal window instead of a dialog.
        """
        toplevel = self.main_dialog.get_toplevel()
        toplevel.set_type_hint(gdk.WINDOW_TYPE_HINT_NORMAL)

    def set_confirm_widget(self, widget_name):
        """
        Make a widget confirmable, eg activating that widget would
        close the dialog.
        :param widget_name: name of the widget to be confirmable
        """
        self.main_dialog.set_confirm_widget(widget_name)

    def set_message(self, message, message_type=gtk.MESSAGE_INFO):
        """Sets a message for this editor
        :param message: message to add
        :param message_type: type of message to add
        """
        self.main_dialog.set_message(message, message_type)

    # RunnableView
    # This delegate everything to self.main_dialog

    def close(self):
        self.main_dialog.close()

    def run(self):
        self.main_dialog.run()

    def get_current_toplevel(self):
        return self.main_dialog.get_current_toplevel()

    def destroy(self):
        self.main_dialog.destroy()

    def set_transient_for(self, window):
        self.main_dialog.set_transient_for(window)

    # Callbacks

    def _on_main_dialog__cancel(self, dialog, retval):
        self.cancel()

    def _on_main_dialog__confirm(self, dialog, retval):
        return self.confirm()

    def _validation_function(self, is_valid):
        self.refresh_ok(is_valid)
开发者ID:romaia,项目名称:stoq,代码行数:104,代码来源:baseeditor.py

示例2: BaseEditor

# 需要导入模块: from stoqlib.gui.base.dialogs import BasicDialog [as 别名]
# 或者: from stoqlib.gui.base.dialogs.BasicDialog import set_transient_for [as 别名]

#.........这里部分代码省略.........

        if self._confirm_disabled:
            return False
        if not BaseEditorSlave.confirm(self):
            return False

        self.main_dialog.close()
        if isinstance(self.store, StoqlibStore):
            self.store.retval = self.retval

        log.info("%s: Closed (confirmed), retval=%r" % (
            self.__class__.__name__, self.retval))

        return True

    def enable_ok(self):
        """
        Enable the ok button of the dialog, eg makes it possible
        to close/confirm the dialog.
        """
        self.main_dialog.enable_ok()
        self._confirm_disabled = False

    def disable_ok(self):
        """
        Enable the ok button of the dialog, eg makes it possible
        to close/confirm the dialog.
        """
        self.main_dialog.disable_ok()
        self._confirm_disabled = True

    def enable_normal_window(self):
        """
        Enable the dialog as a normal window.
        This tells the window manager that the window
        should behave as a normal window instead of a dialog.
        """
        toplevel = self.main_dialog.get_toplevel()
        toplevel.set_type_hint(gdk.WINDOW_TYPE_HINT_NORMAL)

    def set_confirm_widget(self, widget_name):
        """
        Make a widget confirmable, eg activating that widget would
        close the dialog.
        :param widget_name: name of the widget to be confirmable
        """
        self.main_dialog.set_confirm_widget(widget_name)

    def set_message(self, message, message_type=None):
        """Sets a message for this editor
        :param message: message to add
        :param message_type: type of message to add
        """
        if message_type is None:
            message_type = gtk.MESSAGE_INFO
        self.main_dialog.set_message(message, message_type)

    # RunnableView
    # This delegate everything to self.main_dialog

    def close(self):
        self.main_dialog.close()

    def run(self):
        self.main_dialog.run()

    def get_current_toplevel(self):
        return self.main_dialog.get_current_toplevel()

    def destroy(self):
        self.main_dialog.destroy()

    def set_transient_for(self, window):
        self.main_dialog.set_transient_for(window)

    # Callbacks

    def _on_main_dialog__cancel(self, dialog, retval):
        return self.cancel()

    def _on_main_dialog__confirm(self, dialog, retval):
        return self.confirm()

    def _validation_function(self, is_valid):
        self.refresh_ok(is_valid)

    def _on_toplevel__delete_event(self, widget, *args, **kwargs):
        # Avoid the dialog being closed when hitting 'Esc' and we would need
        # confirm the cancelation.
        if self._need_cancel_confirmation():
            return True

    def _on_toplevel__response(self, dialog, response, *args, **kwargs):
        # FIXME: For the delete-event to really stops from destroying the
        # dialog, we also need to stop the response event emission. See
        # http://faq.pygtk.org/index.py?req=show&file=faq10.013.htp
        # for more details
        if (self._need_cancel_confirmation() and
                response == gtk.RESPONSE_DELETE_EVENT):
            dialog.emit_stop_by_name('response')
开发者ID:Guillon88,项目名称:stoq,代码行数:104,代码来源:baseeditor.py


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