コード例 #1
0
ファイル: fileview_list.py プロジェクト: numerodix/nametrans
    def set_file_list(self, items, nscanned, progress_widget, result_widget):
        if len(items) > 1000:
            self.turn_off_autosize()
        else:
            self.turn_on_autosize()

        color_left = self.parent.color_diff_left
        color_right = self.parent.color_diff_right
        color_error_bg = self.parent.color_error_bg

        nclashes = 0
        nrows = len(items)

        style_f = ['<span bgcolor="%s">' % color_left, '</span>']
        style_g = ['<span bgcolor="%s">' % color_right, '</span>']
        for (i, item) in enumerate(items):
            col_f, col_g = "white", "white"
            if item.invalid:
                col_g = color_error_bg
                nclashes += 1
            f, g = markupdiff.diff_markup(item.f, item.g, style_f, style_g)
            wrap = '<span font="8.5"><tt>%s</tt></span>'
            f = wrap % f
            g = wrap % g
            self.fileview.Model.AppendValues(f, g, col_f, col_g)
            if i % 100 == 0:
                progress = "Displaying %s files of %s..." % (i, nrows)
                gtkhelper.set_value(progress_widget, progress)
                gtkhelper.process_events()

        result = "%s file(s) scanned, %s file(s) affected" % (nscanned, nrows)
        if nclashes:
            result += ", %s clash(es)" % nclashes
        gtkhelper.set_value(result_widget, result)
コード例 #2
0
    def set_file_list(self, items, nscanned, progress_widget, result_widget):
        if len(items) > 1000:
            self.turn_off_autosize()
        else:
            self.turn_on_autosize()

        color_left = self.parent.color_diff_left
        color_right = self.parent.color_diff_right
        color_error_bg = self.parent.color_error_bg

        nclashes = 0
        nrows = len(items)

        style_f = ['<span bgcolor="%s">' % color_left, '</span>']
        style_g = ['<span bgcolor="%s">' % color_right, '</span>']
        for (i, item) in enumerate(items):
            col_f, col_g = "white", "white"
            if item.invalid:
                col_g = color_error_bg
                nclashes += 1
            f, g = markupdiff.diff_markup(item.f, item.g, style_f, style_g)
            wrap = '<span font="8.5"><tt>%s</tt></span>'
            f = wrap % f
            g = wrap % g
            self.fileview.Model.AppendValues(f, g, col_f, col_g)
            if i % 100 == 0:
                progress = "Displaying %s files of %s..." % (i, nrows)
                gtkhelper.set_value(progress_widget, progress)
                gtkhelper.process_events()

        result = "%s file(s) scanned, %s file(s) affected" % (nscanned, nrows)
        if nclashes:
            result += ", %s clash(es)" % nclashes
        gtkhelper.set_value(result_widget, result)
コード例 #3
0
    def clear_file_list(self):
        self.fileview.Model.Clear()

        # try to reset column width
        self.turn_on_autosize()
        self.fileview.Model.AppendValues('', '', 'white', 'white')
        self.fileview.Model.Clear()

        gtkhelper.process_events()
コード例 #4
0
ファイル: fileview_list.py プロジェクト: numerodix/nametrans
    def clear_file_list(self):
        self.fileview.Model.Clear()

        # try to reset column width
        self.turn_on_autosize()
        self.fileview.Model.AppendValues('', '', 'white', 'white')
        self.fileview.Model.Clear()

        gtkhelper.process_events()
コード例 #5
0
    def run_task(self, func, widgets_to_lock):
        '''ref for responsiveness:
            http://www.mono-project.com/Responsive_Applications'''
        self.detach_auto_compute()
        gtkhelper.set_value(self.label_result, '')
        for w in widgets_to_lock:
            gtkhelper.disable(w)
        gtkhelper.process_events()

        func()

        for w in widgets_to_lock:
            gtkhelper.enable(w)
        gtkhelper.set_value(self.label_progress, '')
        self.attach_auto_compute()
コード例 #6
0
ファイル: gnametrans.py プロジェクト: numerodix/nametrans
    def run_task(self, func, widgets_to_lock):
        '''ref for responsiveness:
            http://www.mono-project.com/Responsive_Applications'''
        self.detach_auto_compute()
        gtkhelper.set_value(self.label_result, '')
        for w in widgets_to_lock:
            gtkhelper.disable(w)
        gtkhelper.process_events()

        func()

        for w in widgets_to_lock:
            gtkhelper.enable(w)
        gtkhelper.set_value(self.label_progress, '')
        self.attach_auto_compute()
コード例 #7
0
 def progress_handler_gui(*args):
     msg = src.callbacks._get_progress_line(*args)
     gtkhelper.set_value(widget, msg)
     gtkhelper.process_events()
コード例 #8
0
ファイル: handlers.py プロジェクト: numerodix/nametrans
 def progress_handler_gui(*args):
     msg = src.callbacks._get_progress_line(*args)
     gtkhelper.set_value(widget, msg)
     gtkhelper.process_events()