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


Python HIGHBox.get_children方法代码示例

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


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

示例1: DiffWindow

# 需要导入模块: from higwidgets.higboxes import HIGHBox [as 别名]
# 或者: from higwidgets.higboxes.HIGHBox import get_children [as 别名]

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

            # Closing file to avoid problems with file descriptors
            file_desc.close()
        else:
            diff = Diff(text1, text2)
            diff = diff.generate ()
            diff.insert(0, '''<pre>(This diff is been shown in pure text \
because you dont have Python 2.4 or higher.)\n''')
            diff.append('</pre>')

            file_desc = open(self.temp_view, 'w')
            file_desc.writelines(diff)

            # Closing file to avoid problems with file descriptors
            file_desc.close()
        
        webbrowser.open("file://" + self.temp_view, autoraise=1)

    def show_legend_window(self, widget):
        legend_window = DiffLegendWindow(self.colors)
        legend_window.run()
        legend_window.destroy()
        self.text_changed(None)

    def text_changed (self, widget):
        text1 = self.scan_buffer1.get_text(self.scan_buffer1.get_start_iter(),\
                                           self.scan_buffer1.get_end_iter())
        text2 = self.scan_buffer2.get_text(self.scan_buffer2.get_start_iter(),\
                                           self.scan_buffer2.get_end_iter())

        if text1 != '' and text2 != '':
            if self.compare_mode.get_active():
                self.compare_view.make_diff(self.scan_chooser1.parsed_scan,
                                            self.scan_chooser2.parsed_scan)
                self.compare_view.activate_color(self.check_color.get_active())
            else:
                self.text1 = text1.split ('\n')
                self.text2 = text2.split ('\n')
            
                self.diff = Diff(self.text1, self.text2)
                self.text_view.txt_diff_result.get_buffer().set_text\
                               ('\n'.join(self.diff.generate_without_banner()))
                self.text_view.activate_color(self.check_color.get_active())
                self.text_view._text_changed(None)

    def resize_vpane(self, widget):
        exp1 = not widget.get_expanded()
        if widget == self.scan_chooser1.exp_scan:
            exp2 = self.scan_chooser2.exp_scan.get_expanded()
        else:
            exp2 = self.scan_chooser1.exp_scan.get_expanded()

        if not exp1 and not exp2:
            self.vpaned.compute_position(-1, 0, 500)
            self.size_allocate(gtk.gdk.Rectangle(width=self.initial_size[0],
                                                 height=self.initial_size[1]))
            self.queue_resize()

    def _change_to_text(self, widget):
        if not widget.get_active():
            return

        self.umit_conf.diff_mode = "text"

        children = self.hbox_result.get_children()
        if children:
            self.hbox_result.remove(children[0])
            self.compare_view.hide()
        
        self.hbox_result._pack_expand_fill(self.text_view)
        self.text_view.show_all()
        
        self.compare_mode.set_active(False)
        self.text_changed(None)

    def _change_to_compare(self, widget):
        if not widget.get_active():
            return

        self.umit_conf.diff_mode = "compare"

        children = self.hbox_result.get_children()
        if children:
            self.hbox_result.remove(children[0])
            self.text_view.hide()
        
        self.hbox_result._pack_expand_fill(self.compare_view)
        self.compare_view.show_all()
        
        self.text_mode.set_active(False)
        self.text_changed(None)

    def _set_color(self, widget):
        activate = widget.get_active()
        self.umit_conf.colored_diff = activate
        self.compare_view.activate_color(activate)
        self.text_view.activate_color(activate)

    def close(self, widget=None, extra=None):
        self.destroy()
开发者ID:aregee,项目名称:network-scanner,代码行数:104,代码来源:DiffCompare.py


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