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


Python npyscreen.notify_wait方法代码示例

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


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

示例1: actionHighlighted

# 需要导入模块: import npyscreen [as 别名]
# 或者: from npyscreen import notify_wait [as 别名]
def actionHighlighted(self, act_on_this, keypress):
        zeek_installed, suricata_installed, filebeat_installed = zeek_profile.ProcessProfiler().is_installed, \
                                                                 suricata_profile.ProcessProfiler().is_installed, \
                                                                 filebeat_profile.ProcessProfiler().is_installed
        app_mapping = {}
        if filebeat_installed:
            if zeek_installed and suricata_installed:
                app_mapping = zeek_and_suricata_mapping
            elif zeek_installed:
                app_mapping = zeek_only_mapping
            elif suricata_installed:
                app_mapping = suricata_only_mapping

        npyscreen.notify_wait(
            act_on_this, form_color='GOODHL'
        )
        app_mapping[act_on_this]().run()
        exit(0) 
开发者ID:DynamiteAI,项目名称:dynamite-nsm,代码行数:20,代码来源:agent_config_selector.py

示例2: whenPressed

# 需要导入模块: import npyscreen [as 别名]
# 或者: from npyscreen import notify_wait [as 别名]
def whenPressed(self):

        if self.parent.parentApp.filebeat_config.is_kafka_output_enabled():
            self.parent.parentApp.filebeat_config.enable_logstash_output()
            output_type = 'LogStash'
        else:
            self.parent.parentApp.filebeat_config.enable_kafka_output()
            output_type = 'Kafka'

        npyscreen.notify_wait(
            'Enabling {} output mode.'.format(output_type), form_color='GOODHL'
        )
        self.parent.parentApp.filebeat_config.write_config()

        self.parent.parentApp.removeForm('MAIN')
        self.parent.parentApp.addForm('MAIN', FilebeatInstanceSettingsForm, name='FileBeat Configuration')
        self.parent.parentApp.removeForm('EDITTARGETFM')
        self.parent.parentApp.addForm('EDITTARGETFM', EditTargetsForm, name='Edit FileBeat Targets')
        self.parent.parentApp.switchForm('MAIN') 
开发者ID:DynamiteAI,项目名称:dynamite-nsm,代码行数:21,代码来源:filebeat_interface_config.py

示例3: afterEditing

# 需要导入模块: import npyscreen [as 别名]
# 或者: from npyscreen import notify_wait [as 别名]
def afterEditing(self):
        selected_option = self.parentApp.SELECTED_RESULT
        try:
            selection = self.parentApp.RESULTS.get(selected_option)
            if not selection:
                npyscreen.notify_wait("Please select a ROM by hitting ENTER on your selection", "Selection error")
            self.search = self.parentApp.SCRAPER_OBJ
            download_thread = ThreadDownload(selection=selection)
            download_thread.start()
            # self.download_link = self.search.get_link(selection)
            while download_thread.is_alive():
                npyscreen.notify("Please wait while Romulus downloads this ROM...", "Downloading")
            # self.d = Download()
            # self.d.download(self.download_link, platform=selection.system)
            npyscreen.notify("The ROM is now available on EmulationStation", "Success")
            self.parentApp.setNextForm('MAIN')
        except TypeError:
            npyscreen.notify_wait('Please hit ENTER on your selection to select it', 'Error') 
开发者ID:ArthurMoore85,项目名称:pi_romulus,代码行数:20,代码来源:results.py

示例4: onCleanExit

# 需要导入模块: import npyscreen [as 别名]
# 或者: from npyscreen import notify_wait [as 别名]
def onCleanExit(self):
        if self.do_notify:
            npyscreen.notify_wait("setup.py will exit in a moment. " + self.exit_reason, title="Warning!") 
开发者ID:GluuFederation,项目名称:community-edition-setup,代码行数:5,代码来源:tui.py

示例5: on_ok

# 需要导入模块: import npyscreen [as 别名]
# 或者: from npyscreen import notify_wait [as 别名]
def on_ok(self):
        try:
            self.parentApp.filebeat_config.set_agent_tag(self.agent_tag.value)
            self.parentApp.filebeat_config.write_config()
        except exceptions.InvalidAgentTag as e:
            res = npyscreen.notify_ok_cancel(
                e.message,
                form_color='DANGER',
            )
            if not res:
                return
        npyscreen.notify_wait(
            'Be sure to restart the agent for changes to take effect!', form_color='WARNING'
        )
        self.parentApp.setNextForm(None) 
开发者ID:DynamiteAI,项目名称:dynamite-nsm,代码行数:17,代码来源:filebeat_interface_config.py

示例6: on_ok

# 需要导入模块: import npyscreen [as 别名]
# 或者: from npyscreen import notify_wait [as 别名]
def on_ok(self):
        npyscreen.notify_wait(
            'Be sure to restart the agent for changes to take effect!', form_color='WARNING'
        )
        for script in self.rendered_scripts:
            if script.value:
                self.parentApp.zeek_script_config.enable_script(script.name)
            else:
                self.parentApp.zeek_script_config.disable_script(script.name)

        self.parentApp.zeek_script_config.write_config()
        self.parentApp.setNextForm(None) 
开发者ID:DynamiteAI,项目名称:dynamite-nsm,代码行数:14,代码来源:zeek_script_config.py

示例7: on_ok

# 需要导入模块: import npyscreen [as 别名]
# 或者: from npyscreen import notify_wait [as 别名]
def on_ok(self):
        try:
            if self.threads_text.value == '':
                self.threads_text.value = 'auto'
            int(self.threads_text.value)
        except ValueError:
            if self.threads_text.value != 'auto':
                npyscreen.notify_ok_cancel(
                    'Worker Threads must be given as an integer.',
                    form_color='DANGER'
                )
                return
        if not self.net_interface_text.value:
            npyscreen.notify_ok_cancel(
                'Network Interface cannot be blank.',
                form_color='DANGER'
            )
            return
        if self.value:
            self.parentApp.suricata_config.remove_afpacket_interface(self.value)
        self.parentApp.suricata_config.add_afpacket_interface(
            interface=self.net_interface_text.value,
            threads=self.threads_text.value,
            cluster_id=self.cluster_id.value,
            bpf_filter=self.bpf_filter.value
        )

        # Switch back to the main interface
        npyscreen.notify_wait(
            self.net_interface_text.value + ' has been updated!', form_color='GOOD'
        )
        self.parentApp.suricata_config.write_config()
        self.parentApp.removeForm('MAIN')
        self.parentApp.addForm('MAIN', SuricataInstanceSettingsForm, name='Suricata Instance Configuration')
        self.parentApp.switchForm('MAIN') 
开发者ID:DynamiteAI,项目名称:dynamite-nsm,代码行数:37,代码来源:suricata_interface_config.py

示例8: on_ok

# 需要导入模块: import npyscreen [as 别名]
# 或者: from npyscreen import notify_wait [as 别名]
def on_ok(self):
        npyscreen.notify_wait(
            'Be sure to restart the agent for changes to take effect!', form_color='WARNING'
        )
        self.parentApp.setNextForm(None) 
开发者ID:DynamiteAI,项目名称:dynamite-nsm,代码行数:7,代码来源:zeek_node_config.py

示例9: on_ok

# 需要导入模块: import npyscreen [as 别名]
# 或者: from npyscreen import notify_wait [as 别名]
def on_ok(self):
        npyscreen.notify_wait(
            'Be sure to restart the agent for changes to take effect!', form_color='WARNING'
        )
        for rule in self.rendered_rules:
            if rule.value:
                self.parentApp.suricata_rule_config.enable_rule(rule.name)
            else:
                self.parentApp.suricata_rule_config.disable_rule(rule.name)

        self.parentApp.suricata_rule_config.write_config()
        self.parentApp.setNextForm(None) 
开发者ID:DynamiteAI,项目名称:dynamite-nsm,代码行数:14,代码来源:suricata_rule_config.py

示例10: on_ok

# 需要导入模块: import npyscreen [as 别名]
# 或者: from npyscreen import notify_wait [as 别名]
def on_ok(self):
        """ Perform restoration on the backup file selected """
        if self.dir_select.value:
            npyscreen.notify_wait('In the process of restoring',
                                  title='Restoring...')
            status = self.restore(self.dirs[self.dir_select.value[0]])
            if status[0]:
                npyscreen.notify_confirm('Status of restore:\n' +
                                         status[1])
            else:
                npyscreen.notify_confirm(status[1])
            self.quit()
        else:
            npyscreen.notify_confirm('Choose a version to restore from') 
开发者ID:CyberReboot,项目名称:vent,代码行数:16,代码来源:backup.py

示例11: getQR

# 需要导入模块: import npyscreen [as 别名]
# 或者: from npyscreen import notify_wait [as 别名]
def getQR(self):
        if not self.parentApp.setup.showingToken:
            return
        while self.parentApp.setup.token is None:
            npyscreen.notify_wait(
                "Waiting for token...\n\nOpen Signal > Settings > Linked Devices > Add and scan the QR code.", title="Setup")
            time.sleep(0.1)
        if not self.parentApp.setup.token.startswith('tsdevice:'):
            npyscreen.notify_confirm(
            "There was not a valid registration token returned from signal-cli\n\nReturned token: {}".format(self.parentApp.setup.token), title="Setup")
            exit(0)
        return pyqrcode.create(self.parentApp.setup.token, error='L').terminal(quiet_zone=1) 
开发者ID:jwoglom,项目名称:signal-curses,代码行数:14,代码来源:forms.py

示例12: run

# 需要导入模块: import npyscreen [as 别名]
# 或者: from npyscreen import notify_wait [as 别名]
def run(self):
        log('message thread')

        if self.app.state.bus == 'system':
            self.bus = pydbus.SystemBus()
        else:
            self.bus = pydbus.SessionBus()

        log('waiting for ({}) dbus...'.format(self.app.state.bus))
        self.signal = exception_waitloop(self.get_message_bus, GLib.Error, 60)
        if not self.signal:
            log('dbus err')
            npyscreen.notify_wait('Unable to get signal {} bus. Messaging functionality will not function.'.format(
                self.app.state.bus), title='Error in SignalDaemonThread')
            exit(1)
        log('got dbus')
        # self.signal.onMessageReceived

        while True:
            item = self.queue.get()
            log('queue item', item)
            if 'exit' in item:
                break
            self.do_action(**item)
            self.queue.task_done()
        log('message thread exit') 
开发者ID:jwoglom,项目名称:signal-curses,代码行数:28,代码来源:__init__.py

示例13: h_save_message_part

# 需要导入模块: import npyscreen [as 别名]
# 或者: from npyscreen import notify_wait [as 别名]
def h_save_message_part(self, ch):
        self.parent.saveMessagePart()
        npyscreen.notify_wait("Message part saved to your downloads folder: \n %s" % self.parent.DOWNLOAD_DIR) 
开发者ID:sealingtech,项目名称:EDCOP,代码行数:5,代码来源:stdfmemail.py

示例14: on_ok

# 需要导入模块: import npyscreen [as 别名]
# 或者: from npyscreen import notify_wait [as 别名]
def on_ok(self):
        """
        Take the tool selections and add them as plugins
        """
        def diff(first, second):
            """
            Get the elements that exist in the first list and not in the second
            """
            second = set(second)
            return [item for item in first if item not in second]

        def popup(original_tools, branch, thr, title):
            """
            Start the thread and display a popup of the tools being added until
            the thread is finished
            """
            thr.start()
            tool_str = 'Adding tools...'
            npyscreen.notify_wait(tool_str, title=title)
            while thr.is_alive():
                tools = diff(ManifestTools(), original_tools)
                if tools:
                    tool_str = ''
                for tool in tools:
                    pre_tool = 'Added: ' + branch + '/' + tool + '\n'
                    tool_str = pre_tool + tool_str
                npyscreen.notify_wait(tool_str, title=title)
                time.sleep(1)
            return

        original_tools = ManifestTools()
        for branch in self.tools_tc:
            tools = []
            for tool in self.tools_tc[branch]:
                if self.tools_tc[branch][tool].value:
                    # get rid of temporary show for multiple tools in same
                    # directory
                    if tool == '/':
                        tools.append(('.', ''))
                    else:
                        tools.append((tool, ''))
            repo = self.parentApp.repo_value['repo']
            version = self.parentApp.repo_value['versions'][branch]
            api_action = Tools(version=version, branch=branch)
            thr = threading.Thread(target=api_action.new, args=(),
                                   kwargs={'tool_type': 'repo',
                                           'uri': repo,
                                           'tools': tools})
            popup(original_tools, branch, thr,
                  'Please wait, adding tools for the ' + branch + ' branch...')
        npyscreen.notify_confirm('Done adding repository: ' +
                                 self.parentApp.repo_value['repo'],
                                 title='Added Repository')
        self.quit() 
开发者ID:CyberReboot,项目名称:vent,代码行数:56,代码来源:choose_tools.py

示例15: handleEnvelope

# 需要导入模块: import npyscreen [as 别名]
# 或者: from npyscreen import notify_wait [as 别名]
def handleEnvelope(self, env):
        self.envelopes.append(env)

        if env.timestamp and (time.time() - env.epoch_ts) >= 60:
            log('ignoring envelope due to time difference of',
                str((time.time() - env.epoch_ts)))
            return

        if env.dataMessage.is_message():
            if self.state.shouldDisplayEnvelope(env):
                self.addEnvelope(env)
            elif self.state.shouldNotifyEnvelope(env):
                log('notifying line')
                gen_line = env.gen_line()
                txt = '{}:\n\n{}'.format(gen_line[0], gen_line[2])
                if env.group:
                    txt = 'Group: {}\n'.format(json.dumps(env.group)) + txt
                npyscreen.notify_wait(
                    txt, title='New Message from {}'.format(gen_line[1]))
            else:
                log('not displaying or notifying dataMessage')

        if env.syncMessage.is_read_message():
            log('is read message', env.syncMessage)
            for e in self.envelopes[:-1]:
                if env.syncMessage.sync_read_matches(e):
                    log('mark_read', e)
                    self.markAsEnvelope(e, '(read)')

        if env.callMessage.is_offer():
            self.app.wMain.addValues([
                ('*', 'You are receiving an inbound call from {}'.format(env.source))
            ])
            npyscreen.notify_wait(
                'You are receiving an inbound call', title='Call from {}'.format(env.source))

        if env.callMessage.is_busy():
            self.app.wMain.addValues([
                ('*', 'The caller {} is busy'.format(env.source))
            ])
            npyscreen.notify_wait('The caller is busy',
                                  title='Call from {}'.format(env.source))

        if env.callMessage.is_hangup():
            self.app.wMain.addValues([
                ('*', 'The caller {} hung up'.format(env.source))
            ])
            npyscreen.notify_wait('The caller hung up',
                                  title='Call from {}'.format(env.source)) 
开发者ID:jwoglom,项目名称:signal-curses,代码行数:51,代码来源:__init__.py


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