Manages loading maps etc. """ import os, tarfile, re, httplib import uuid from _dispatch import Signal from intensity.base import * from intensity.logging import * from intensity.utility import * # Signals map_load_start = Signal(providing_args=['activity_id', 'map_asset_id']) map_load_finish = Signal() # Only sent if map loads successfully # Globals curr_activity_id = None ##< The activity ID of the current activity curr_map_asset_id = None ##< The asset id of this map, whose location gives us the prefix, etc. curr_map_prefix = None def get_curr_activity_id(): return curr_activity_id def set_curr_activity_id(activity_id): global curr_activity_id curr_activity_id = activity_id
import os, cgi, urllib, time, tempfile, hashlib, shutil, httplib, pickle, tarfile, urlparse from functools import partial from _dispatch import Signal from intensity.logging import * from intensity.post_multipart import post_multipart from intensity.signals import multiple_send from intensity.errors import IntensityUserCancellation # Signals # Called when checking if an asset exists in up-to-date form locally check_existing = Signal(providing_args=['asset_info']) # Called when an asset is actually modified, and when a file inside it (if it is # an archive) is modified. In the latter case 'filename' is given. Filenames # are relative to the home_dir/data/ asset_item_updated = Signal(providing_args=['asset_info', 'filename']) # Errors class AssetRetrievalError(Exception): pass def calculate_hash(filename, hasher): try: f = open(filename, "rb")
(self, sender, len(responses))) return responses[0][1] def multiple_send(self, sender, **named): ''' Sends a signal using Django's system, and returns just the return values (no senders). ''' responses = self.send(sender, **named) return map(lambda response: response[1], responses) # shutdown = Signal() bandwidth_out = Signal(providing_args=['bytes']) def signal_bandwidth_out(bytes): # C++ access is to this bandwidth_out.send(None, bytes=bytes) validate_client = Signal( providing_args=['client_number', 'ip_addr', 'username', 'can_edit']) client_connect = Signal(providing_args=['client_number']) client_disconnect = Signal(providing_args=['client_number']) text_message = Signal(providing_args=['client_number', 'text'])
import os, cgi, urllib, time, tempfile, hashlib, shutil, httplib, pickle, tarfile, urlparse from functools import partial from _dispatch import Signal from intensity.logging import * from intensity.post_multipart import post_multipart from intensity.signals import multiple_send from intensity.errors import IntensityUserCancellation # Signals # Called when checking if an asset exists in up-to-date form locally check_existing = Signal(providing_args=['asset_info']) # Called when an asset is actually modified, and when a file inside it (if it is # an archive) is modified. In the latter case 'filename' is given. Filenames # are relative to the home_dir/packages/ asset_item_updated = Signal(providing_args=['asset_info', 'filename']) # Errors class AssetRetrievalError(Exception): pass def calculate_hash(filename, hasher): try: f = open(filename, "rb")
""" Manages loading maps etc. """ import os, tarfile, re, httplib import uuid from _dispatch import Signal from intensity.base import * from intensity.logging import * from intensity.utility import * # Signals map_load_start = Signal(providing_args=['activity_id', 'map_asset_id']) map_load_finish = Signal() # Only sent if map loads successfully # Globals curr_activity_id = None ##< The activity ID of the current activity curr_map_asset_id = None ##< The asset id of this map, whose location gives us the prefix, etc. curr_map_prefix = None def get_curr_activity_id(): return curr_activity_id def set_curr_activity_id(activity_id): global curr_activity_id