示例#1
0
	def __init__(self, plugin, window):
		Signals.__init__(self)

		self._window = window
		self._plugin = plugin
		
		# Insert document helpers
		for view in window.get_views():
			self.add_document_helper(view)
		
		self.connect_signal(window, 'tab-added', self.on_tab_added)
		self.connect_signal(window, 'tab-removed', self.on_tab_removed)
示例#2
0
    def __init__(self, view):
        Signals.__init__(self)

        view.set_data(Constants.DOCUMENT_HELPER_KEY, self)

        self._view = view
        self._buffer = None
        self.validation = None

        self.connect_signal(self._view, 'notify::buffer', self.on_notify_buffer)
        self.reset_buffer(self._view.get_buffer())

        self.initialize_event_handlers()

        self._re_any_tag = re.compile('^\s*(\**|[0-9][.0-9]*\))(\s*)((DONE|CHECK|TODO|DEADLINE):\s*(\([0-9]{1,2}((\s*(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*)|-[0-9]{1,2}(-[0-9]{2,})?|(January|February|April|May|June|July|August|September|October|November|December))\))?\s* ?)?')
        self._re_list = re.compile('^(\s*)(\*+|[0-9][.0-9]*\))(\s*)')
        self._re_continuations = re.compile('^(\s*)((#+|%+)\s*)')
示例#3
0
        def compute_aggregate_signals(prices, long, short, signal):
            """

            :param prices:
            :param long:
            :param short:
            :param signal:
            :return:
            """
            return [Signals.to_signal(sum([signal_component.value for signal_component in signals_vector]))
                    for signals_vector in TechnicalIndicators.MACD.compute_separate_signals(prices, long, short, signal)]
示例#4
0
    def __init__(self, verbose=False):
        super(Main, self).__init__()

        # fields
        self.cwd = None
        self.program_dir = None
        self.graphics_path = None  # move to MainWindow
        self.tmp_path = None
        self.Data = None
        self.verbose = verbose

        self.initialize_paths()
        self.print_startup_msg()

        # ini
        self.IO = IO_Object(self)
        self.Options = Options_Object(self)
        self.Processing = Processing_Object(self)
        self.ROIs = ROIs_Object(self)

        self.MainWindow = MainWindow_Widget(self)

        # centrally managed signals
        self.Signals = Signals(self)
示例#5
0
 def registerSignals(self):
     from Signals import Signals
     Signals.registerZopeSignals([self.cfg.eventlog,
                                  self.cfg.access,
                                  self.cfg.trace])
示例#6
0
    set_locale(LOCALE_ID)

import zdaemon
# from this point forward we can use the zope logger
# importing ZDaemon before importing ZServer causes ZServer logging
# not to work.

# Import ZServer before we open the database or get at interesting
# application code so that ZServer's asyncore gets to be the
# official one. Also gets SOFTWARE_HOME, INSTANCE_HOME, and CLIENT_HOME
import ZServer

# install signal handlers if on posix
if os.name == 'posix':
    from Signals import Signals
    Signals.registerZopeSignals()

# Location of the ZServer pid file. When Zope starts up it will write
# its PID to this file.  If Zope is run under zdaemon control, zdaemon
# will write to this pidfile instead of Zope.
PID_FILE=os.path.join(CLIENT_HOME, 'Z2.pid')

if USE_DAEMON and not READ_ONLY:
    import App.FindHomes
    sys.ZMANAGED=1
    # zdaemon.run creates a process which "manages" the actual Zope
    # process (restarts it if it dies).  The management process passes along
    # signals that it receives to its child.
    zdaemon.run(sys.argv, os.path.join(CLIENT_HOME, PID_FILE))

os.chdir(CLIENT_HOME)
from App.config import getConfiguration
instancehome = getConfiguration().instancehome
if instancehome is not None:
  log_directory = path.join(instancehome, 'log')
  if path.isdir(log_directory):
    from Signals import Signals
    from ZConfig.components.logger.loghandler import FileHandler
    log_file_handler = FileHandler(path.join(log_directory,
                                                'ERP5SyncML.log'))
    # Default zope log format string borrowed from
    # ZConfig/components/logger/factory.xml, but without the extra "------"
    # line separating entries.
    log_file_handler.setFormatter(Formatter(
      "%(asctime)s %(levelname)s %(name)s %(message)s",
      "%Y-%m-%dT%H:%M:%S"))
    Signals.registerZopeSignals([log_file_handler])
    syncml_logger.addHandler(log_file_handler)
    syncml_logger.propagate = 0


def checkAlertCommand(syncml_request):
  """
  This parse the alert commands received and return a
  dictionnary mapping database to sync mode
  """
  database_alert_list = []
  # XXX To be moved on engine
  search = getSite().portal_categories.syncml_alert_code.searchFolder
  for alert in syncml_request.alert_list:
    if alert["data"] == "222":
      # 222 is for asking next message, do not care
示例#8
0
from App.config import getConfiguration
instancehome = getConfiguration().instancehome
if instancehome is not None:
    log_directory = path.join(instancehome, 'log')
    if path.isdir(log_directory):
        from Signals import Signals
        from ZConfig.components.logger.loghandler import FileHandler
        log_file_handler = FileHandler(
            path.join(log_directory, 'ERP5SyncML.log'))
        # Default zope log format string borrowed from
        # ZConfig/components/logger/factory.xml, but without the extra "------"
        # line separating entries.
        log_file_handler.setFormatter(
            Formatter("%(asctime)s %(levelname)s %(name)s %(message)s",
                      "%Y-%m-%dT%H:%M:%S"))
        Signals.registerZopeSignals([log_file_handler])
        syncml_logger.addHandler(log_file_handler)
        syncml_logger.propagate = 0


def checkAlertCommand(syncml_request):
    """
  This parse the alert commands received and return a
  dictionnary mapping database to sync mode
  """
    database_alert_list = []
    # XXX To be moved on engine
    search = getSite().portal_categories.syncml_alert_code.searchFolder
    for alert in syncml_request.alert_list:
        if alert["data"] == "222":
            # 222 is for asking next message, do not care