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


Python warning_dialog.warning_dialog函数代码示例

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


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


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