• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python warning_dialog.warning_dialog函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中warning_dialog.warning_dialog函数的典型用法代码示例。如果您正苦于以下问题:Python warning_dialog函数的具体用法?Python warning_dialog怎么用?Python warning_dialog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: unregister_popup

    def unregister_popup( self, w, reg, is_group=False ):

        window = gtk.MessageDialog( parent=self.window,
                flags=0,
                type=gtk.MESSAGE_QUESTION,
                buttons=gtk.BUTTONS_NONE,
                message_format="Unregistering Suite " + reg + """
\nDelete suite definition directory too? (DANGEROUS!)""")

        window.add_button( gtk.STOCK_YES, gtk.RESPONSE_YES )
        window.add_button( gtk.STOCK_NO, gtk.RESPONSE_NO )
        window.add_button( gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL )
        response = window.run()
        window.destroy()

        if is_group:
            reg = '^' + reg + '\..*$'
        else:
            reg = '^' + reg + '$'

        if response == gtk.RESPONSE_YES:
            command = "cylc unregister -f -d " + reg
        elif response == gtk.RESPONSE_NO:
            command = "cylc unregister " + reg
        else:
            command = None
        if command:
            res, out = run_get_stdout( command )
            if not res:
                warning_dialog( '\n'.join(out), self.window ).warn()
开发者ID:raghu330,项目名称:cylc,代码行数:30,代码来源:dbchooser.py


示例2: filter

    def filter( self, w, excl_e, incl_e, fbox ):
        excl = excl_e.get_text()
        incl = incl_e.get_text()
        if excl == '':
            excl = None
        if incl == '':
            incl == None
        for filt in excl, incl:
            if not filt:
                continue
            try:
                re.compile( filt )
            except:
                warning_dialog( "Bad Expression: " + filt ).warn()
        self.t.filter_include = incl
        self.t.filter_exclude = excl

        fstates = []
        for b in fbox.get_children():
            if not b.get_active():
                # sub '_' from button label keyboard mnemonics
                fstates.append( re.sub('_', '', b.get_label()))
        if len(fstates) > 0:
            self.t.state_filter = fstates
        else:
            self.t.state_filter = None
        
        self.t.action_required = True
开发者ID:devkev,项目名称:cylc,代码行数:28,代码来源:SuiteControlGraph.py


示例3: save

    def save(self, w, tv):
        tb = tv.get_buffer()

        start = tb.get_start_iter()
        end = tb.get_end_iter()
        txt = tb.get_text(start, end)

        dialog = gtk.FileChooserDialog(
            title="Save As",
            action=gtk.FILE_CHOOSER_ACTION_SAVE,
            buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_SAVE, gtk.RESPONSE_OK),
        )
        filter = gtk.FileFilter()
        filter.set_name("any")
        filter.add_pattern("*")
        dialog.add_filter(filter)

        response = dialog.run()

        if response != gtk.RESPONSE_OK:
            dialog.destroy()
            return False

        fname = dialog.get_filename()
        dialog.destroy()

        try:
            f = open(fname, "wb")
        except IOError, x:
            warning_dialog(str(x), self.window).warn()
开发者ID:bjlittle,项目名称:cylc,代码行数:30,代码来源:gcapture.py


示例4: on_find_clicked

    def on_find_clicked(self, e):
        tv = self.textview
        tb = tv.get_buffer()
        needle = e.get_text()

        if not needle:
            s, e = tb.get_bounds()
            tb.remove_tag(self.ftag, s, e)
            return

        self.stdout_updater.freeze = True
        self.freeze_button.set_active(True)
        self.freeze_button.set_label("_Reconnect")
        if not self.search_warning_done:
            warning_dialog("Find Next disconnects the live feed. Click Reconnect when you're done.", self.window).warn()
            self.search_warning_done = True

        if needle == self.find_current:
            s = self.find_current_iter
        else:
            s, e = tb.get_bounds()
            tb.remove_tag(self.ftag, s, e)
            s = tb.get_end_iter()
            tv.scroll_to_iter(s, 0)
        try:
            f, l = s.backward_search(needle, gtk.TEXT_SEARCH_VISIBLE_ONLY)
        except:
            warning_dialog('"' + needle + '"' + " not found", self.window).warn()
        else:
            tb.apply_tag(self.ftag, f, l)
            self.find_current_iter = f
            self.find_current = needle
            tv.scroll_to_iter(f, 0)
开发者ID:bjlittle,项目名称:cylc,代码行数:33,代码来源:gcapture.py


示例5: filter

    def filter( self, w, excl_e, incl_e, fbox ):
        filters = {}
        filters["excl"] = excl_e.get_text()
        filters["incl"] = incl_e.get_text()
        for filt_name, filt in filters.items():
            if not filt:
                filters[filt_name] = None
                continue
            try:
                re.compile( filt )
            except re.error as exc:
                warning_dialog(
                    'Bad filter regex: %s: error: %s' % (filt, exc)).warn()
                filters[filt_name] = None

        self.t.filter_include = filters["incl"]
        self.t.filter_exclude = filters["excl"]

        fstates = []
        for b in fbox.get_children():
            if not b.get_active():
                # sub '_' from button label keyboard mnemonics
                fstates.append( re.sub('_', '', b.get_label()))
        if len(fstates) > 0:
            self.t.state_filter = fstates
        else:
            self.t.state_filter = None

        self.t.action_required = True
开发者ID:dmanubens,项目名称:cylc,代码行数:29,代码来源:SuiteControlGraph.py


示例6: copy_popup

    def copy_popup( self, w, reg, is_group=False ):

        window = EntryDialog( parent=self.window,
                flags=0,
                type=gtk.MESSAGE_QUESTION,
                buttons=gtk.BUTTONS_OK_CANCEL,
                message_format="Copy Suite " + reg + """To
NAME,TOP_DIRECTORY""")

        out = window.run()
        window.destroy()
        if out:
            try:
                name, topdir = re.split(' *, *', out )
            except Exception, e:
                warning_dialog( str(e), self.window ).warn()
            else:
                print name, topdir
                topdir = os.path.expanduser( os.path.expandvars( topdir ))
                print name, topdir
                command = "cylc cp " + reg + ' ' + name + ' ' + topdir
                print command
                res, out = run_get_stdout( command )
                if not res:
                    warning_dialog( '\n'.join(out), self.window ).warn()
                elif out:
                    info_dialog( '\n'.join(out), self.window ).inform()
开发者ID:raghu330,项目名称:cylc,代码行数:27,代码来源:dbchooser.py


示例7: on_find_clicked

    def on_find_clicked( self, tv, e ):
        needle = e.get_text ()
        if not needle:
            return

        self.t.freeze = True
        self.freeze_button.set_active(True)
        self.freeze_button.set_label('Reconnect')
        if not self.search_warning_done:
            warning_dialog( "Find Next disconnects the live feed; click Reconnect when you're done" ).warn()
            self.search_warning_done = True

        tb = tv.get_buffer ()

        if needle == self.find_current:
            s = self.find_current_iter
        else:
            s,e = tb.get_bounds()
            tb.remove_all_tags( s,e )
            s = tb.get_end_iter()
            tv.scroll_to_iter( s, 0 )
        try:
            f, l = s.backward_search (needle, gtk.TEXT_SEARCH_TEXT_ONLY) 
        except:
            warning_dialog( '"' + needle + '"' + " not found" ).warn()
        else:
            tag = tb.create_tag( None, background="#70FFA9" )
            tb.apply_tag( tag, f, l )
            self.find_current_iter = f
            self.find_current = needle
            tv.scroll_to_iter( f, 0 )
开发者ID:areinecke,项目名称:cylc,代码行数:31,代码来源:logviewer.py


示例8: graph_suite_popup

def graph_suite_popup( reg, cmd_help, defstartc, defstopc, graph_opts,
                       gcapture_windows, tmpdir, parent_window=None):
    """Popup a dialog to allow a user to configure their suite graphing."""
    try:
        import xdot
    except Exception, x:
        warning_dialog( str(x) + "\nGraphing disabled.", parent_window ).warn()
        return False
开发者ID:tomgreen66,项目名称:cylc,代码行数:8,代码来源:graph.py


示例9: check_filter_entry

 def check_filter_entry( self, e ):
     ftext = self.filter_entry.get_text()
     try:
         re.compile(ftext)
     except re.error as exc:
         warning_dialog(
             'Bad filter regex: %s: error: %s' % (ftext, exc)).warn()
         self.t.filter = ""
     else:
         self.t.filter = ftext
     self.t.action_required = True
开发者ID:dmanubens,项目名称:cylc,代码行数:11,代码来源:SuiteControlLED.py


示例10: filter

 def filter(self, filtr_e ):
     if filtr_e == "":
         # reset
         self.start_updater()
         return
     filtr = filtr_e.get_text()
     try:
         re.compile( filtr )
     except:
         warning_dialog( "Bad Regular Expression: " + filtr, self.window ).warn()
         filtr_e.set_text("")
         self.start_updater()
         return
     self.start_updater( filtr )
开发者ID:raghu330,项目名称:cylc,代码行数:14,代码来源:dbchooser.py


示例11: visible_cb

    def visible_cb(self, model, iter ):
        # visibility result determined by state matching active check
        # buttons: set visible if model value NOT in filter_states;
        # and matching name against current name filter setting.
        # (state result: sres; name result: nres)

        ctime = model.get_value(iter, 0 )
        name = model.get_value(iter, 1)
        if name is None or ctime is None:
            return True
        name = re.sub( r'<.*?>', '', name )

        if ctime == name:
            # Cycle-time line (not state etc.)
            return True

         # Task or family.
        state = model.get_value(iter, 2 ) 
        if state is not None:
            state = re.sub( r'<.*?>', '', state )
        sres = state not in self.tfilter_states

        try:
            if not self.tfilt:
                nres = True
            elif self.tfilt in name:
                # tfilt is any substring of name
                nres = True
            elif re.search( self.tfilt, name ):
                # full regex match
                nres = True
            else:
                nres = False
        except:
            warning_dialog( 'Bad filter regex? ' + self.tfilt ).warn()
            nres = False

        if model.iter_has_child( iter ):
            # Family.
            path = model.get_path( iter )

            sub_st = self.ttree_paths.get( path, {} ).get( 'states', [] )
            sres = sres or any([t not in self.tfilter_states for t in sub_st])

            if self.tfilt:
                sub_nm = self.ttree_paths.get( path, {} ).get( 'names', [] )
                nres = nres or any([self.tfilt in n for n in sub_nm])

        return sres and nres
开发者ID:areinecke,项目名称:cylc,代码行数:49,代码来源:SuiteControlTree.py


示例12: alias_popup

    def alias_popup( self, w, reg ):

        window = EntryDialog( parent=self.window,
                flags=0,
                type=gtk.MESSAGE_QUESTION,
                buttons=gtk.BUTTONS_OK_CANCEL,
                message_format="Alias Suite Name " + reg )

        alias = window.run()
        window.destroy()
        if alias:
            command = "cylc alias " + reg + ' ' + alias
            res, out = run_get_stdout( command )
            if not res:
                warning_dialog( '\n'.join(out), self.window ).warn()
开发者ID:steoxley,项目名称:cylc,代码行数:15,代码来源:dbchooser.py


示例13: reregister_popup

    def reregister_popup( self, w, reg, is_group=False ):

        window = EntryDialog( parent=self.window,
                flags=0,
                type=gtk.MESSAGE_QUESTION,
                buttons=gtk.BUTTONS_OK_CANCEL,
                message_format="Reregister Suite " + reg + " As")

        rereg = window.run()
        window.destroy()
        if rereg:
            command = "cylc reregister " + reg + ' ' + rereg
            res, out = run_get_stdout( command )
            if not res:
                warning_dialog( '\n'.join(out), self.window ).warn()
开发者ID:raghu330,项目名称:cylc,代码行数:15,代码来源:dbchooser.py


示例14: compare_popup

    def compare_popup( self, w, reg ):

        window = EntryDialog( parent=self.window,
                flags=0,
                type=gtk.MESSAGE_QUESTION,
                buttons=gtk.BUTTONS_OK_CANCEL,
                message_format="Compare Suite " + reg + " With")

        compare = window.run()
        window.destroy()
        if compare:
            command = "cylc diff " + reg + ' ' + compare
            res, out = run_get_stdout( command )
            if not res:
                warning_dialog( '\n'.join(out), self.window ).warn()
            else:
                # TODO: need a bigger scrollable window here!
                info_dialog( '\n'.join(out), self.window ).inform()
开发者ID:raghu330,项目名称:cylc,代码行数:18,代码来源:dbchooser.py


示例15: rotate_log

    def rotate_log(self, bt, go_older):
        if go_older:
            self.level += 1
        else:
            self.level -= 1
        if self.level < 0:
            warning_dialog(
                """
At newest rotation; reloading in case 
the suite has been restarted.""",
                self.window,
            ).warn()
            self.level = 0
            # but update view in case user started suite after gui
        if self.current_log() not in os.listdir(self.dir):
            if go_older:
                warning_dialog("Older log not available", self.window).warn()
                self.level -= 1
                return
            else:
                warning_dialog("Newer log not available", self.window).warn()
                self.level += 1
                return
        else:
            self.file = self.current_log()
        self.update_view()
开发者ID:tomgreen66,项目名称:cylc,代码行数:26,代码来源:cylc_logviewer.py


示例16: graph_suite

def graph_suite( reg, is_warm, ofile, start, stop, graph_opts,
                 gcapture_windows, tmpdir, window=None ):
    """Launch the cylc graph command with some options."""
    options = graph_opts
    if ofile != '':
        options += ' -o ' + ofile

    if True:
        if start != '':
            try:
                ct(start)
            except CycleTimeError,x:
                warning_dialog( str(x), window ).warn()
                return False
        if stop != '':
            if start == '':
                warning_dialog(
                        "You cannot override Final Cycle without " +
                        "overriding Initial Cycle.").warn()
                return False

            try:
                ct(stop)
            except CycleTimeError,x:
                warning_dialog( str(x), window ).warn()
                return False
开发者ID:tomgreen66,项目名称:cylc,代码行数:26,代码来源:graph.py


示例17: on_find_clicked

    def on_find_clicked( self, tv, e ):
        needle = e.get_text ()
        if not needle:
            return

        tb = tv.get_buffer ()

        if needle == self.find_current:
            s = self.find_current_iter
        else:
            s,e = tb.get_bounds()
            tb.remove_all_tags( s,e )
            s = tb.get_start_iter()
            tv.scroll_to_iter( s, 0 )
        try:
            f, l = s.forward_search (needle, gtk.TEXT_SEARCH_TEXT_ONLY)
        except:
            warning_dialog( '"' + needle + '"' + " not found" ).warn()
        else:
            tag = tb.create_tag( None, background="#70FFA9" )
            tb.apply_tag( tag, f, l )
            self.find_current_iter = l
            self.find_current = needle
            tv.scroll_to_iter( f, 0 )
开发者ID:raghu330,项目名称:cylc,代码行数:24,代码来源:textload.py


示例18: update_gui

 def update_gui( self, line ):
     try:
         line.decode('utf-8')
     except UnicodeDecodeError as exc:
         if self.has_warned_corrupt:
             return False
         self.has_warned_corrupt = True
         dialog = warning_dialog("Problem reading file:\n    %s: %s" %
                                 (type(exc).__name__, exc))
         gobject.idle_add(dialog.warn)
         return False
     if self.critical_re and re.search( self.critical_re, line ):
         self.logbuffer.insert_with_tags( self.logbuffer.get_end_iter(), line, self.critical_tag )
     elif self.warning_re and re.search( self.warning_re, line ):
         self.logbuffer.insert_with_tags( self.logbuffer.get_end_iter(), line, self.warning_tag )
     elif self.tag:
         self.logbuffer.insert_with_tags( self.logbuffer.get_end_iter(), line, self.tag )
     else:
         self.logbuffer.insert( self.logbuffer.get_end_iter(), line )
     self.logview.scroll_to_iter( self.logbuffer.get_end_iter(), 0 )
     return False
开发者ID:bjlittle,项目名称:cylc,代码行数:21,代码来源:tailer.py


示例19: feed

            gobject.idle_add( self.update_gui, out )
            if self.proc != None:
                # See comment below
                self.proc.poll()
        else:
            # Live feed (pythonic 'tail -f') for local job submission.
            #if not os.path.exists( self.logfile ):
            #    #gobject.idle_add( self.warn, "File not found: " + self.logfile )
            #    print "File not found: " + self.logfile
            #    #print "Disconnecting from tailer thread"
            #    return
            try:
                gen = tail.tail( open( self.logfile ))
            except Exception as x:
                # e.g. file not found
                dialog = warning_dialog( type(x).__name__ + ": " + str(x) )
                gobject.idle_add(dialog.warn)
                return

            while not self.quit:
                if not self.freeze:
                    line = gen.next()
                    if line:
                        gobject.idle_add( self.update_gui, line )
                if self.proc != None:
                    # poll the subprocess; this reaps its exit code and thus
                    # prevents the pid of the finished process staying in
                    # the OS process table (a "defunct process") until the
                    # parent process exits.
                    self.proc.poll()
                # The following doesn't work, not sure why, perhaps because
开发者ID:dmanubens,项目名称:cylc,代码行数:31,代码来源:tailer.py


示例20: warning_dialog

            if self.stop_summary is None:
                self.stop_summary = dump.get_stop_state_summary(
                                                       self.cfg.suite,
                                                       self.cfg.owner,
                                                       self.cfg.host)
                self._flag_new_update()
            return False
        else:
            try:
                daemon_version = self.sinfo.get('get cylc version')
            except KeyError:
                daemon_version = "??? (pre 6.1.2?)"
            if daemon_version != CYLC_VERSION:
                warning_dialog(
                    "Warning: cylc version mismatch!\n\n" +
                    "Suite running with %r.\n" % daemon_version +
                    "gcylc at %r.\n" % CYLC_VERSION,
                    self.info_bar.get_toplevel()
                ).warn()
            self.stop_summary = None
            self.err_log_lines = []
            self.err_log_size = 0
            self.status = "connected"
            self.connected = True
            self.poll_schd.stop()
            self._flag_new_update()
            return True

    def connection_lost( self ):
        self._summary_update_time = None
        self.state_summary = {}
        self.full_state_summary = {}
开发者ID:ScottWales,项目名称:cylc,代码行数:32,代码来源:updater.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python warning_tests.inner函数代码示例发布时间:2022-05-26
下一篇:
Python warlock.model_factory函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap