示例#1
0
def test_getLogger():
    logger = plogging.getLogger('test_getLogger')
    logger.setLevel(plogging.DEBUG)

    handler = plogging.FileHandler('test.log')
    handler.setLevel(plogging.DEBUG)
    logger.addHandler(handler)

    logger.info("hello world")
示例#2
0
def test_print_logging():
    logger = plogging.getLogger()
    logger.setLevel(plogging.DEBUG)

    # stream = io.StringIO()  # StringIo isn't working
    stream = sys.stdout
    handler = plogging.StreamHandler(stream)
    handler.setLevel(plogging.DEBUG)
    handler.setFormatter(plogging.Formatter(**STANDARD_FORMATTER))
    logger.addHandler(handler)

    logger.info("hello world")
示例#3
0
import re, os.path, platform
from HTMLParser import HTMLParser
import pymel.util as util
import pymel.versions as versions
import plogging
from pymel.mayautils import getMayaLocation

try:
    from pymel.util.external.BeautifulSoup import BeautifulSoup, NavigableString
except ImportError:
    from BeautifulSoup import BeautifulSoup, NavigableString
from keyword import iskeyword as _iskeyword

_logger = plogging.getLogger(__name__)

def mayaIsRunning():
    """
    Returns True if maya.cmds have  False otherwise.

    Early in interactive startup it is possible for commands to exist but for Maya to not yet be initialized.

    :rtype: bool
    """

    # Implementation is essentially just a wrapper for getRunningMayaVersionString -
    # this function was included for clearer / more readable code

    try :
        from maya.cmds import about
        about(version=True)
        return True
示例#4
0
文件: apicache.py 项目: Lavenda/pymel
""" Imports Maya API methods in the 'api' namespace, and defines various utilities for Python<->API communication """

# They will be imported / redefined later in Pymel, but we temporarily need them here
import inspect
import re
import itertools

import pymel.api as api
import pymel.versions as versions
import pymel.util as _util
import startup
import plogging as _plogging
from pymel.api.plugins import mpxNamesToApiEnumNames

_logger = _plogging.getLogger(__name__)

if versions.current() < versions.v2014:
    NUCLEUS_MFNDAG_BUG = True
    SYMMETRY_CONSTRAINT_MFNDAG_BUG = False
elif versions.current() < versions.v2015:
    NUCLEUS_MFNDAG_BUG = False
    SYMMETRY_CONSTRAINT_MFNDAG_BUG = True
else:
    NUCLEUS_MFNDAG_BUG = False
    SYMMETRY_CONSTRAINT_MFNDAG_BUG = False

#===============================================================================
# Utility classes
#===============================================================================

import wx
import os
import os.path
import plogging
import wx.lib.filebrowsebutton as filebrowse
from identifiers import INTERNAL_BORDER_WIDTH, EXTERNAL_BORDER_WIDTH

outlog = plogging.getLogger('client')

class AdvancedPreferences(wx.Dialog):
    def __init__(self, parent, ID, config, log):
        pre = wx.PreDialog()
        pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
        pre.Create(parent, ID, 'Advanced Preferences', wx.DefaultPosition, wx.DefaultSize, wx.DEFAULT_FRAME_STYLE)
        pre.width = 400
        #Turn the object into a proper dialog wrapper.
        self.PostCreate(pre)

        self.log = log
        self.parentApp = parent
        self.config = config

        self.preference_keys = ['syncold', 'archivesynced', 'archivedfilesdir']
        sizer = wx.BoxSizer(wx.VERTICAL)
        self.fields = {}

        #Sync Old:
        for key in self.preference_keys:
            if self.config.getShowVar(key):
                box = wx.BoxSizer(wx.HORIZONTAL)
                if key == 'syncold':
示例#6
0
import sys
import time
import shutil
import shlex
import pipes
import tempfile

import Queue
import threading
from subprocess import Popen, PIPE, STDOUT

from version import VERSION

import plogging

outlog = plogging.getLogger('client')
from MainWindow import APPSTATE


def nullFn(*args, **kwargs):
    outlog.debug('null fn')
    pass


class RemoteSyncParams(object):
    def __init__(self, configdict={}, username="******"):
        self.host = ""
        self.rootdir = ""
        self.flags = []
        self.username = ""
        self.rules = []
示例#7
0
import sys, os, string, time, cPickle
import os.path
from identifiers import *

SAVEFILE_NAME = os.path.join(DATADIR, "settings.cfg")
import plogging

outlog = plogging.getLogger("client")


class MSDSConfig(object):
    def __init__(self, **kwargs):
        """hardcoded config for the initial object creation"""
        # format is:
        # key: [value, formalKeyName, helpText]
        # e.g.:
        #'user' : ['jsmith', 'Username', 'The username with which to logon to the remote server']
        self.store = {
            "user": ["default_user", "Username", "The username with which to logon to the remote server."],
            #'remotehost' : ['127.0.0.1', 'Remote Host', 'The address of the remote rsync machine.'],
            # 'remotedir' : ['syncdir_dest', 'Dest Dir'],
            "sitename": ["defaultsite", "Site Name", "A name to identify this installation, e.g. Lab #1.", False],
            "stationname": [
                "defaultstation",
                "Stationname",
                "A name to identify this installation, e.g. Lab #1.",
                False,
            ],
            "organisation": [
                "defaultorg",
                "Organisation",
示例#8
0
def test_configs():
    plogging.set_config_function('print_config', print, 'testing',
                                 'set_config_function')

    logger = plogging.getLogger()
    logger.start_process()