當前位置: 首頁>>代碼示例>>Python>>正文


Python TextDisplay.scroll_mark_onscreen方法代碼示例

本文整理匯總了Python中Dialogs.TextDisplay.scroll_mark_onscreen方法的典型用法代碼示例。如果您正苦於以下問題:Python TextDisplay.scroll_mark_onscreen方法的具體用法?Python TextDisplay.scroll_mark_onscreen怎麽用?Python TextDisplay.scroll_mark_onscreen使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Dialogs.TextDisplay的用法示例。


在下文中一共展示了TextDisplay.scroll_mark_onscreen方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: MainWindow

# 需要導入模塊: from Dialogs import TextDisplay [as 別名]
# 或者: from Dialogs.TextDisplay import scroll_mark_onscreen [as 別名]
class MainWindow(gtk.Window):
    """The topmost window with menus, the tool bar, and other major windows."""

    def __init__(self, platform):
        """
        MainWindow contructor
        Setup the menu, toolbar, flowgraph editor notebook, block selection window...
        """
        self._platform = platform
        #setup window
        gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
        vbox = gtk.VBox()
        self.hpaned = gtk.HPaned()
        self.add(vbox)
        #create the menu bar and toolbar
        self.add_accel_group(Actions.get_accel_group())
        vbox.pack_start(Bars.MenuBar(), False)
        vbox.pack_start(Bars.Toolbar(), False)
        vbox.pack_start(self.hpaned)
        #create the notebook
        self.notebook = gtk.Notebook()
        self.page_to_be_closed = None
        self.current_page = None
        self.notebook.set_show_border(False)
        self.notebook.set_scrollable(True) #scroll arrows for page tabs
        self.notebook.connect('switch-page', self._handle_page_change)
        #setup containers
        self.flow_graph_vpaned = gtk.VPaned()
        #flow_graph_box.pack_start(self.scrolled_window)
        self.flow_graph_vpaned.pack1(self.notebook)
        self.hpaned.pack1(self.flow_graph_vpaned)
        self.btwin = BlockTreeWindow(platform, self.get_flow_graph);
        self.hpaned.pack2(self.btwin, False) #dont allow resize
        #create the reports window
        self.text_display = TextDisplay()
        #house the reports in a scrolled window
        self.reports_scrolled_window = gtk.ScrolledWindow()
        self.reports_scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        self.reports_scrolled_window.add(self.text_display)
        self.reports_scrolled_window.set_size_request(-1, DEFAULT_REPORTS_WINDOW_WIDTH)
        self.flow_graph_vpaned.pack2(self.reports_scrolled_window, False) #dont allow resize
        #load preferences and show the main window
        Preferences.load(platform)
        self.resize(*Preferences.main_window_size())
        self.flow_graph_vpaned.set_position(Preferences.reports_window_position())
        self.hpaned.set_position(Preferences.blocks_window_position())
        self.show_all()
        self.reports_scrolled_window.hide()
        self.btwin.hide()

    ############################################################
    # Event Handlers
    ############################################################

    def _quit(self, window, event):
        """
        Handle the delete event from the main window.
        Generated by pressing X to close, alt+f4, or right click+close.
        This method in turns calls the state handler to quit.
        
        Returns:
            true
        """
        Actions.APPLICATION_QUIT()
        return True

    def _handle_page_change(self, notebook, page, page_num):
        """
        Handle a page change. When the user clicks on a new tab,
        reload the flow graph to update the vars window and
        call handle states (select nothing) to update the buttons.
        
        Args:
            notebook: the notebook
            page: new page
            page_num: new page number
        """
        self.current_page = self.notebook.get_nth_page(page_num)
        Messages.send_page_switch(self.current_page.get_file_path())
        Actions.PAGE_CHANGE()

    ############################################################
    # Report Window
    ############################################################

    def add_report_line(self, line):
        """
        Place line at the end of the text buffer, then scroll its window all the way down.
        
        Args:
            line: the new text
        """
        self.text_display.insert(line)
        self.text_display.scroll_mark_onscreen(self.text_display.get_buffer().get_insert())

    ############################################################
    # Pages: create and close
    ############################################################

    def new_page(self, file_path='', show=False):
#.........這裏部分代碼省略.........
開發者ID:36V3mA21Hz,項目名稱:gnuradio,代碼行數:103,代碼來源:MainWindow.py


注:本文中的Dialogs.TextDisplay.scroll_mark_onscreen方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。