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

Python wb_common.dprint_ex函数代码示例

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

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



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

示例1: run_version_select_form

def run_version_select_form(version):
    form = Form(Form.main_form())
    top_vbox = newBox(False)
    top_vbox.set_padding(16)
    top_vbox.set_spacing(16)

    info_hbox = newBox(True)
    info_hbox.set_spacing(16)

    img_box = newImageBox()
    img_box.set_image("warning_icon.png")

    right_vbox = newBox(False)
    right_vbox.set_spacing(12)

    warn_label = newLabel("Server version %s is not supported by Workbench\nconfiguration file management tool." % ".".join(map(lambda x: str(x), version)))
    right_vbox.add(warn_label, False, False)

    warn_label = newLabel("Although, you can select different server version\nfor the tool to use. Suggested version "
                          "is given\nbelow. You can either pick version or type one."
                         )
    right_vbox.add(warn_label, False, False)

    warn_label = newLabel("Valid version formats are X.Y.ZZ or X.Y.\nAll other variants will resort to default - 5.1.")
    right_vbox.add(warn_label, False, False)

    if (type(version) is not tuple):
      version = (5,1)
      dprint_ex(1, "Given version is not a valid tuple object")

    try:
      version_maj = int(version[0]) + int(version[1]) / 10.0
    except (ValueError, IndexError), e:
      version_maj = 5.1
开发者ID:aoyanglee,项目名称:Travel-Inc,代码行数:34,代码来源:wb_admin_config_file_ui.py


示例2: shutdown_event

 def shutdown_event(self):
   self.poll_control = self.skip_poll
   if self.dbconn:
     self.dbconn.disconnect()
   self.dbconn = None
   self.poll_control = self.stopped
   dprint_ex(3, "SqlDataSource shutdown. poll_control =", self.poll_control)
开发者ID:Arrjaan,项目名称:Cliff,代码行数:7,代码来源:wba_monitor_be.py


示例3: get_password_for

    def get_password_for(self, service_type): # Raises OperationCancelledError if user cancels pwd dlg. 
        force_reset = False
        if self.pwd_store.has_key(service_type):
            if self.pwd_store[service_type] is None:
                force_reset = True
            else:
                return self.pwd_store[service_type]

        details = self.get_password_parameters(service_type)
        if not details: # No password needed for this service_type
            return None
        
        # special case for UAC used in windows
        if details == "UAC":
            return "UAC"

        title, service, account = details

        dprint_ex(2, "request password for %s => %s, %s, %s" % (service_type, title, service, account))

        accepted, password = mforms.Utilities.find_or_ask_for_password(title, service, account, force_reset)
        if accepted:
            if not password:
                password = ""
            self.pwd_store[service_type] = password
            return password
        else:
            raise OperationCancelledError("Password input cancelled")
开发者ID:aoyanglee,项目名称:Travel-Inc,代码行数:28,代码来源:wb_server_control.py


示例4: reader

  def reader(self, ssh_session):
    what = None
    out = ""
    timeouts = 12
    while self.running[0]: # running is passed in list via "refernce"
      try:
        ch = ssh_session.recv(1)
        timeouts = 12
        if ch == "C":
          what = self.parse_cpu
        elif ch == "M":
          what = self.parse_mem
        elif ch == "\r" or ch == "\n":
          if what is not None:
            what(out)
          what = None
          out = ""
        elif ch in "0123456789. ":
          out += ch
        elif ch == ",":
          out += "."
        else:
          what = None
          out = ""
      except socket.timeout:
        timeouts -= 1
        if timeouts <= 0:
          ssh_session.close()
          raise Exception("Can't read from remote Windows script")

    dprint_ex(1, "Leaving monitor thread which polls remote windows")
开发者ID:Arrjaan,项目名称:Cliff,代码行数:31,代码来源:wba_monitor_be.py


示例5: poll

  def poll(self):
    if self.running[0] is False:
      self.ch.stdin.write("exit\r\n")
      self.ch.stdin.flush()
      return

    self.ch.stdin.write("cpu\r\n")
    self.ch.stdin.flush()

    self.ch.stdin.write("mem\r\n")
    self.ch.stdin.flush()

    value = self.get_mem()
    try:
      value = float(value)
    except ValueError:
      dprint_ex(3, "Can not convert mem value", value, " to float")
      value = None

    if value is not None:
      self.mem_widget[0].set_value(value)
      self.ctrl_be.uitask(self.mem_widget[0].set_description, "Mem: " + str(int(value)) + "%")

    value = self.get_cpu()
    try:
      value = float(value)
    except ValueError:
      value = None
    if value is not None:
      self.cpu_widget[0].set_value(value/100)
      self.ctrl_be.uitask(self.cpu_widget[0].set_description ,"CPU: " + str(int(value)) + "%")
开发者ID:Arrjaan,项目名称:Cliff,代码行数:31,代码来源:wba_monitor_be.py


示例6: refresh_tasks_thread

    def refresh_tasks_thread(self):
        dprint_ex(2, "Entering refresh tasks thread")

        while not self.closing:
            status = "unknown"
            try:
                status = self.ctrl_be.is_server_running(verbose=0)
            except Exception, exc:
                import traceback
                traceback.print_exc()
                print "exception getting server status: %s" % exc

            control_event = None
            if self.last_server_status != status:
                if status == "running":
                    control_event = "server_started"
                elif status == "stopped":
                    control_event = "server_stopped"

            if control_event:
                self.ctrl_be.event_from_main(control_event)

            dprint_ex(3, "server running", status, ", self.closing =", self.closing)
            self.last_server_status = status

            time.sleep(self.refresh_tasks_sleep_time)
开发者ID:verflucht,项目名称:unlock_repo_feria,代码行数:26,代码来源:wb_admin_main.py


示例7: poll_sources

 def poll_sources(self):
   while self.running[0] and self.ctrl_be.running:
     #sleep here
     for cmd in self.sources:
       cmd.poll()
     time.sleep(self.interval)
   dprint_ex(1, "exiting monitor thread...")
开发者ID:Arrjaan,项目名称:Cliff,代码行数:7,代码来源:wba_monitor_be.py


示例8: server_stopped_event

 def server_stopped_event(self):
     dprint_ex(1, "Handling stop event")
     if len(self.tabs) > 0 and hasattr(self.tabs[0], "print_output"):
         self.ctrl_be.uitask(self.tabs[0].print_output, "Server is stopped")
     self.notify_server_status_change("stopped")
     self.refresh_tasks_sleep_time = 3
     dprint_ex(1, "Done handling stop event")
开发者ID:verflucht,项目名称:unlock_repo_feria,代码行数:7,代码来源:wb_admin_main.py


示例9: server_started_event

 def server_started_event(self):
     dprint_ex(1, "Handling start event")
     if len(self.tabs) > 0 and hasattr(self.tabs[0], 'print_output'):
         self.ctrl_be.uitask(self.tabs[0].print_output, "Server is running")
     self.notify_server_status_change("running")
     self.refresh_tasks_sleep_time = 2
     dprint_ex(1, "Done handling start event")
开发者ID:verflucht,项目名称:unlock_repo_feria,代码行数:7,代码来源:wb_admin_main.py


示例10: create_ui

    def create_ui(self):
      self.loading = True

      self.cfg_be = wb_admin_config_file_be.WbAdminConfigFileBE(self.server_profile, self.ctrl_be)

      sys_config_path = self.server_profile.config_file_path
      if sys_config_path is None:
        sys_config_path = ""
      self.file_name_ctrl.set_value(sys_config_path)
      self.section_ctrl.add_changed_callback(self.clear_and_load)
      try:
        self.myopts = self.cfg_be.get_possible_options()
        option_stats = self.cfg_be.get_option_set_stats()
        dprint_ex(1, "Options stats: '%s'" % str(option_stats))
        if option_stats and type(option_stats) is dict:
          added = option_stats.get("added", None)
          if added is not None and added < 10:
            user_selected_version = run_version_select_form(option_stats["version"])
            self.server_profile.set_server_version(".".join(map(lambda x: str(x), user_selected_version)))
            self.cfg_be.reload_possible_options()
            self.myopts = self.cfg_be.get_possible_options()
            option_stats = self.cfg_be.get_option_set_stats()
            dprint_ex(1, "Options stats after version correction: '%s'" % str(option_stats))
      except KeyError:
        Utilities.show_error("Error", "Wrong version '" + self.version + "'given to admin plugin", "Close", None, None)

      self.load_options_from_cfg()

      #build ordered list of pages. Initially only skeleton pages are created, means only names.
      # Values into pages will be load as soon as page is switched to.
      self.pages = {}
      for page_name, page_content in self.myopts.iteritems():
        self.pages[int(page_content['position'])] = Page(page_name, page_content) # False means page not created
      # page key is its position in UI. As we can have pages positions set like (1,2,4,5)
      # the position set needs to be sorted so pages appear in specified order
      page_positions = self.pages.keys()
      page_positions.sort()

      # Create dummy pages according to assigned position
      for page_pos in page_positions:
        page = self.pages[page_pos]
        page.panel = newScrollPanel(mforms.ScrollPanelNoFlags)
        self.tab_view.add_page(page.panel, page.page_name)

      if debug_level > 0:
        # Create file page
        page = Page("File", None)
        page.panel = newTextBox(mforms.BothScrollBars)
        page.set_update_cb(self.update_file_content_tab)
        self.pages[max(self.pages.keys()) + 1] = page
        self.tab_view.add_page(page.panel, page.page_name)

      # Create first page, so we display something from start
      self.create_page(1)
      self.loading = True # create_page resets loading flag

      self.tab_view.add_tab_changed_callback(self.tab_changed)

      self.loading = False
开发者ID:aoyanglee,项目名称:Travel-Inc,代码行数:59,代码来源:wb_admin_config_file_ui.py


示例11: server_started_event

 def server_started_event(self):
   self.poll_control = self.started
   if self.dbconn:
     self.dbconn.disconnect()
     self.dbconn = None
   self.dbconn = self.ctrl_be.get_new_sql_connection(True)
   self.poll_control = self.polling
   dprint_ex(3, "SqlDataSource server started. poll_control =", self.poll_control)
开发者ID:Arrjaan,项目名称:Cliff,代码行数:8,代码来源:wba_monitor_be.py


示例12: shutdown

 def shutdown(self):
     dprint_ex(2, " closing")
     self.closing = True
     for tab in self.tabs:
         if hasattr(tab, "shutdown"):
             res = tab.shutdown()
             if res is False:  # It has to explicitely return False to cancel shutdown
                 self.closing = False
开发者ID:verflucht,项目名称:unlock_repo_feria,代码行数:8,代码来源:wb_admin_main.py


示例13: connection_selected

 def connection_selected(self):
     dprint_ex(4, "Enter")
     if not self.connection_list.get_selected_node():
         self.kill_button.set_enabled(False)
         self.killq_button.set_enabled(False)
     else:
         self.kill_button.set_enabled(True)
         self.killq_button.set_enabled(True)
     dprint_ex(4, "Leave")
开发者ID:verflucht,项目名称:unlock_repo_feria,代码行数:9,代码来源:wb_admin_connections.py


示例14: update_ui

    def update_ui(self, server_status):
        dprint_ex(3, "server_status on enter is %s" % str(server_status))
        
        if not self.server_profile.admin_enabled:
            return

        self.is_server_running_prev_check = server_status
        if self.ctrl_be.target_version and self.ctrl_be.target_version.is_supported_mysql_version_at_least(5, 7, 5):
            self.offline_mode_btn.show(True)
        else:
            self.offline_mode_btn.show(False)
                
        if server_status in ("running", "starting", "offline"):
            if server_status == "starting":
                self.long_status_msg.set_text("The database server is starting...")
                self.start_stop_btn.set_enabled(False)
                self.short_status_msg.set_color("#DDCC00")
                self.offline_mode_btn.set_text("Bring Offline")
                self.offline_mode_btn.set_enabled(False)
            elif server_status == "offline":
                self.offline_mode_btn.set_text("Bring Online")
                self.offline_mode_btn.set_enabled(True)
                server_status = "offline"
                self.short_status_msg.set_color("#0000B0")
                self.long_status_msg.set_text("The database server is in offline mode. To put it back into online mode, use the \"Online mode\" button")
            else:
                self.offline_mode_btn.set_enabled(True)
                self.offline_mode_btn.set_text("Bring Offline")
                self.start_stop_btn.set_enabled(True)
                self.short_status_msg.set_color("#00B000")
                self.long_status_msg.set_text("The database server is started and ready for client connections. To shut the server down, use the \"Stop Server\" button")
            self.short_status_msg.set_text(server_status)
            self.start_stop_btn.set_text("Stop Server")
        elif server_status in ("stopped", "stopping"):
            if server_status == "stopping":
                self.long_status_msg.set_text("The database server is stopping...")
                self.start_stop_btn.set_enabled(False)
                self.offline_mode_btn.set_enabled(False)
                self.short_status_msg.set_color("#DDCC00")
            else:
                self.start_stop_btn.set_enabled(True)
                self.offline_mode_btn.set_enabled(False)
                self.short_status_msg.set_color("#B00000")
                self.long_status_msg.set_text("The database server is stopped. To start the Server, use the \"Start Server\" button")
            self.short_status_msg.set_text(server_status)
            self.start_stop_btn.set_text("Start Server")
        else:
            self.long_status_msg.set_text("The state of the database server could not be determined. Please verify server profile settings.")
            self.short_status_msg.set_text("unknown")
            self.short_status_msg.set_color("#FF0000")
            self.start_stop_btn.set_text("Start Server")
            self.start_stop_btn.set_enabled(False)

        self.relayout()
        dprint_ex(3, "Leave")
开发者ID:pk-codebox-evo,项目名称:mysql-workbench,代码行数:55,代码来源:wb_admin_configuration_startup.py


示例15: __init__

 def __init__(self, sql, mon_be):
   DataSource.__init__(self, "sql_source", mon_be, None)
   self.sql = sql
   self.mon_be = mon_be
   self.sources = {}
   self.rev_sources = {}
   self.dbconn = None
   self.ctrl_be.add_me_for_event("server_started", self)
   self.ctrl_be.add_me_for_event("server_stopped", self)
   self.ctrl_be.add_me_for_event("shutdown", self)
   self.poll_control = self.stopped
   dprint_ex(3, "SqlDataSource created. poll_control =", self.poll_control)
开发者ID:Arrjaan,项目名称:Cliff,代码行数:12,代码来源:wba_monitor_be.py


示例16: parse_mem

  def parse_mem(self, text):
    text = text.strip(" \r\t\n")
    value = None
    try:
      value = float(text)
    except ValueError:
      value = None

    if value is not None:
      self.mtx.acquire()
      try:
        self.mem = value
      finally:
        self.mtx.release()
    dprint_ex(4, "Got mem stat value from remote script -", value)
开发者ID:Arrjaan,项目名称:Cliff,代码行数:15,代码来源:wba_monitor_be.py


示例17: local_run_cmd_windows

def local_run_cmd_windows(command, as_admin=False, admin_password=None, sudo_prefix=None, output_handler=None):
    # wrap cmd
    command = "cmd.exe /C " + command

    out_str =""
    retcode = 1

    if as_admin:
      try:
        from ctypes import c_int, WINFUNCTYPE, windll
        from ctypes.wintypes import HWND, LPCSTR, UINT
        prototype = WINFUNCTYPE(c_int, HWND, LPCSTR, LPCSTR, LPCSTR, LPCSTR, UINT)
        scriptparts = command.partition(" ")
        cmdname = scriptparts[0]
        cmdparams = scriptparts[2]
        paramflags = (1, "hwnd", 0), (1, "operation", "runas"), (1, "file", cmdname), (1, "params", cmdparams), (1, "dir", None), (1, "showcmd", 0)
        SHellExecute = prototype(("ShellExecuteA", windll.shell32), paramflags)
        ret = SHellExecute()
        # > 32 is OK, < 32 is error code
        retcode = 1
        if ret > 32:
          retcode = 0
        else:
          if ret == 0:
            dprint_ex(1, "Out of memory executing %s" % command)
          else:
            dprint_ex(1, "Error %i executing %s" % (ret, command))
        return retcode
      except:
        import traceback
        traceback.print_exc()
    else:
      try:
        stdin, stdout, stderr = os.popen3(command)
        out = stdout.read()
        if not out: out = ""
        err = stderr.read()
        if not err: err = ""
        out_str = out + err
        retcode = stdout.close() # this doesn't really work, it will return None
        stderr.close()
        stdin.close()
      except Exception, exc:
        import traceback
        traceback.print_exc()
        retcode = 1
        out_str = "Internal error: %s"%exc
开发者ID:Arrjaan,项目名称:Cliff,代码行数:47,代码来源:wb_server_management.py


示例18: fetch_windows_shell_info

    def fetch_windows_shell_info(self):
        # get some info from the remote shell
        result, code = self.get_cmd_output("chcp.com")
        if code == 0:
            result = result.strip(" .\r\n").split()
            if len(result) > 0:
                self.cmd_output_encoding = "cp" + result[-1]
        else:
            print "WARNING: Unable to determine codepage from shell: %s"%result

        result, code = self.get_cmd_output("echo %PROCESSOR_ARCHITECTURE%")
        if result:
            result = result.strip()
        ProgramFilesVar = None
        x86var = None
        if result != "x86":#we are on x64 win in x64 mode
            x86var = WIN_PROGRAM_FILES_X86_VAR
            ProgramFilesVar = WIN_PROGRAM_FILES_VAR
        else:
            result, code = self.get_cmd_output("echo %PROCESSOR_ARCHITEW6432%")
            if result:
                result = result.strip()
            if result == "%PROCESSOR_ARCHITEW6432%":#we are on win 32
                x86var = WIN_PROGRAM_FILES_VAR
                ProgramFilesVar = WIN_PROGRAM_FILES_VAR
            else:#32bit app on x64 win
                x86var = WIN_PROGRAM_FILES_VAR
                ProgramFilesVar = WIN_PROGRAM_FILES_X64_VAR

        result, code = self.get_cmd_output("echo "+ ProgramFilesVar)
        if code == 0:
            self.target_shell_variables["%ProgramFiles%"] = result.strip("\r\n")
            if ProgramFilesVar != "%ProgramFiles%":
                self.target_shell_variables[ProgramFilesVar] = result.strip("\r\n")
        else:
            print "WARNING: Unable to fetch ProgramFiles value in Windows machine: %s"%result

        # this one only exists in 64bit windows
        result, code = self.get_cmd_output("echo "+ x86var)
        if code == 0:
            self.target_shell_variables["%ProgramFiles(x86)%"] = result.strip("\r\n")
        else:
            print "WARNING: Unable to fetch ProgramFiles(x86) value in local Windows machine: %s"%result
        
        dprint_ex(1, "Encoding: %s, Shell Variables: %s" % (self.cmd_output_encoding, self.target_shell_variables))
开发者ID:Arrjaan,项目名称:Cliff,代码行数:45,代码来源:wb_server_management.py


示例19: exec_cmd

  def exec_cmd(self, cmd, as_admin = 0, admin_password = None, output_handler = None, read_size = 128, get_channel_cb = None):
    output   = None
    retcode  = None

    self.mtx.acquire()
    dprint_ex(3, "cmd = ", cmd, ", sudo = ", as_admin)
    try:
      (output, retcode) = WbAdminSSH.exec_cmd(self, cmd, 
                                      as_admin=as_admin, 
                                      admin_password=admin_password, 
                                      output_handler=output_handler,
                                      read_size = read_size,
                                      get_channel_cb = get_channel_cb)
      dprint_ex(3, "Done cmd = ", cmd)
    finally:
      self.mtx.release()
    
    return (output, retcode)
开发者ID:Arrjaan,项目名称:Cliff,代码行数:18,代码来源:wb_server_management.py


示例20: is_dir_writable

 def is_dir_writable(self, path):
     ret = False
     
     try:
         dirlist = os.listdir(path)
         filename = '~wba_write_test'
         cnt = 1
         while True:
             if filename + str(cnt) not in dirlist:
                 break
         cnt += 1
         filename = os.path.join(path, filename + str(cnt))
         fp = open(filename, 'w')
         fp.close()
         os.remove(filename)
         ret = True
     except (IOError, OSError), e:
         ret = False
         dprint_ex(1, "code=",e.errno)
开发者ID:Arrjaan,项目名称:Cliff,代码行数:19,代码来源:wb_server_management.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python wcwidth.wcswidth函数代码示例发布时间:2022-05-26
下一篇:
Python utils.get_stat_data函数代码示例发布时间: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