rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
icon = t.getProperty('icon_expr')
icon = t.getIconExprObject()
def addable_types(self, include=None): """Return menu item entries in a TAL-friendly form.
icon = t.getIconExprObject()
def addable_types(self, include=None): """Return menu item entries in a TAL-friendly form.
return context_state.folder()
if context_state.is_structural_folder(): return self.context else: return context_state.folder()
def add_context(self): context_state = getMultiAdapter((self.context, self.request), name='plone_context_state') return context_state.folder()
templateOutput = self.template().encode('utf-8')
templateOutput = self.template(self).encode('utf-8')
def __call__(self): response = self.request.response response.setHeader('Content-Type', 'application/xml+epub') response.setHeader('Content-Disposition', 'attachment; filename=%s.epub' % self.context.id)
zipFile.writestr('META-INF/container.xml', replace('META-INF/container', {}))
zipFile.writestr('META-INF/container.xml', replace('META-INF/container.xml', {}))
def __call__(self): response = self.request.response response.setHeader('Content-Type', 'application/xml+epub') response.setHeader('Content-Disposition', 'attachment; filename=%s.epub' % self.context.id)
folder = self.context[self.context.invokeFactory('Folder', id=epub.ploneID)]
id = epub.ploneID count = 0 while hasattr(self.context, id): count += 1 id = '%s-%i' % (epub.ploneID, count) folder = self.context[self.context.invokeFactory('Folder', id=id)]
def importFile(self, epubFile): zipFile = ZipFile(epubFile, 'r') epub = EpubFile(zipFile)
templateOutput = self.template(self).encode('utf-8')
templateOutput = self.template(self) templateOutput = templateOutput.decode('utf-8') templateOutput = templateOutput.encode('utf-8')
def __call__(self): response = self.request.response response.setHeader('Content-Type', 'application/xml+epub') response.setHeader('Content-Disposition', 'attachment; filename=%s.epub' % self.context.id)
description = description.text.strip()
def chapters(self): guide = self.rootFile.find('guide') if guide == None: return []
if( os.path.exists( self.ptMount + "/ttgo.bif" ) ):
fileTTGObif = self.ptMount + "/ttgo.bif" if( os.path.exists( fileTTGObif ) ):
def GetConfig( self ):
with open( self.ptMount + "/ttgo.bif", "rb" ) as ttgobif:
with open( fileTTGObif, "rb" ) as ttgobif:
def GetConfig( self ):
cmd = ("mkdir '" + self.dirPoi + filename + "'" )
cmd = ("mkdir -p '" + self.dirPoi + filename + "'" )
def addPoiToDatabase( self,entry ):
self.poiCombo.append_text( filename )
def addPoiToDatabase( self,entry ):
cmd += " 2> /dev/null | tail -n +2 | tr -s ' ' | cut -d ' ' -f 4,7 --output-delimiter=,"
cmd += " 2> /dev/null | tail -n +2 | tr -s ' ' | cut -d ' ' -f 4,7-"
def GetPtWithSize( self, type = None, ptMount = None ):
line = line.split( ',', 2 ) self.Debug( 5, "Command result: " + str( int( line[0 ] ) ) + " -> " + line[ 1 ] ) res.append( [ int( line[ 0 ] ), line[ 1 ] ] )
line = line.split( ' ', 1 ) self.Debug( 5, "Command result: " + str( int( line[ 0 ] ) ) + " -> " + line[ -1 ] ) res.append( [ int( line[ 0 ] ), line[ -1 ] ] )
def GetPtWithSize( self, type = None, ptMount = None ):
files = os.listdir( self.dirPoi ) files.sort() for file in files: self.poiCombo.append_text( file )
if( os.path.exists( self.dirPoi ) ): files = os.listdir( self.dirPoi ) files.sort() for file in files: self.poiCombo.append_text( file )
def FramePoi( self, notebook ):
cmd = ( "umount " + self.ptMount )
cmd = ( "umount '" + self.ptMount +"'" )
def UMount(self, mountPoint):
cmd = ("cp '" + self.dirPoi + selectedPoi + "/'* " + self.ptMount + "/" + self.CurrentMap )
cmd = ("cp '" + self.dirPoi + selectedPoi + "/'* '" + self.ptMount + "'/" + self.CurrentMap )
def addPoiToTomtom( self,entry ):
cmd = ("rm " + self.ptMount + "/" + self.CurrentMap + "/'" + file + "'")
cmd = ("rm -f '" + self.ptMount + "'/" + self.CurrentMap + "/'" + file + "'")
def delPoiOnTomtom( self,entry ):
cmd = "cd " + self.ptMount + "; tar -" + option + "f \"" + self.fileName + "\" ."
cmd = "cd '" + self.ptMount + "'; tar -" + option + "f \"" + self.fileName + "\" ."
def BackupRestoreGPS( self, widget, type ):
cmd = "cd " + self.ptMount + "; echo tar -" + option + "f \"" + self.fileName + "\" ."
cmd = "cd '" + self.ptMount + "'; echo tar -" + option + "f \"" + self.fileName + "\" ."
def BackupRestoreGPS( self, widget, type ):
self.popup = gtk.FileChooserDialog( _( "Open..." ), gtk.Window( gtk.WINDOW_TOPLEVEL ),
self.popup = gtk.FileChooserDialog( _( "Open folder..." ), gtk.Window( gtk.WINDOW_TOPLEVEL ),
def addPoiToDatabase( self,entry ):
ip_tags = TagContainer(ip) control_tags = TagContainer(control)
ip_tags = TagContainer() control_tags = TagContainer() ip_tags(ip) control_tags(control)
def main(): # option parser usage = 'peakzilla [OPTIONS] IP_ALIGNMENT CONTROL_ALIGNMENT > RESULTS' parser = OptionParser(usage=usage) parser.add_option("-s", "--fragment_size",\ type = "int", dest="fragment_size", default="200",\ help = "fragment size in bp used to define the upper limit of peak size for modeling: def...
usage = 'peakzilla [OPTIONS] IP_ALIGNMENT CONTROL_ALIGNMENT > RESULTS'
usage = 'peakzilla [OPTIONS] chip.bed control.bed > results.tsv'
def main(): # option parser usage = 'peakzilla [OPTIONS] IP_ALIGNMENT CONTROL_ALIGNMENT > RESULTS' parser = OptionParser(usage=usage) parser.add_option("-s", "--fragment_size",\ type = "int", dest="fragment_size", default="200",\ help = "fragment size in bp used to define the upper limit of peak size for modeling: def...
self.peak_shift = int(median(self.peak_shifts)) self.peak_size = self.peak_shift * 2
if self.peak_shifts: self.peak_shift = int(median(self.peak_shifts)) self.peak_size = self.peak_shift * 2
def build(self): # for all chromosomes look for shifted peaks for chrom in self.tags.get_chrom_names(): plus_peaks = self.find_simple_peaks(chrom, '+') minus_peaks = self.find_simple_peaks(chrom, '-') self.determine_shifts(plus_peaks, minus_peaks) # calculate the meidan peak_shift self.peak_shift = int(median(self.peak...
candidate_survivals = 0
peak_candidate.survivals = 0
def find_peaks(self, chrom): # identify peak candidates on chromosome self.peaks[chrom] = [] # convert tag arrays to deque for fast appending and popping plus_tags = deque(self.ip_tags.get_tags(chrom, '+')) minus_tags = deque(self.ip_tags.get_tags(chrom, '-')) # initalize windows and stuff plus_window = deque([]) minus...
candidate_survivals += 1
peak_candidate.survivals += 1
def find_peaks(self, chrom): # identify peak candidates on chromosome self.peaks[chrom] = [] # convert tag arrays to deque for fast appending and popping plus_tags = deque(self.ip_tags.get_tags(chrom, '+')) minus_tags = deque(self.ip_tags.get_tags(chrom, '-')) # initalize windows and stuff plus_window = deque([]) minus...
if candidate_survivals == self.peak_shift:
if peak_candidate.survivals == self.peak_shift:
def find_peaks(self, chrom): # identify peak candidates on chromosome self.peaks[chrom] = [] # convert tag arrays to deque for fast appending and popping plus_tags = deque(self.ip_tags.get_tags(chrom, '+')) minus_tags = deque(self.ip_tags.get_tags(chrom, '-')) # initalize windows and stuff plus_window = deque([]) minus...
peak_candidate.tag_count = score peak_candidate.position = position peak_candidate.tags = list(plus_window) + list(minus_window) candidate_survivals = 0
peak_candidate = Peak()
def find_peaks(self, chrom): # identify peak candidates on chromosome self.peaks[chrom] = [] # convert tag arrays to deque for fast appending and popping plus_tags = deque(self.ip_tags.get_tags(chrom, '+')) minus_tags = deque(self.ip_tags.get_tags(chrom, '-')) # initalize windows and stuff plus_window = deque([]) minus...
candidate_survivals = 0
def find_peaks(self, chrom): # identify peak candidates on chromosome self.peaks[chrom] = [] # convert tag arrays to deque for fast appending and popping plus_tags = deque(self.ip_tags.get_tags(chrom, '+')) minus_tags = deque(self.ip_tags.get_tags(chrom, '-')) # initalize windows and stuff plus_window = deque([]) minus...
global IGNORE_LIST
def load_lists(force=False): """Load ignore and filtered word lists""" debug_print('Loading ignore list') if not IGNORE_LIST or force is True: global IGNORE_LIST IGNORE_LIST = [ line.lower().strip() for line in open(settings.ignore_list) ] debug_print('Loading filtered word list') if not FILTER_WORDS or force is True:...
global FILTER_WORDS
def load_lists(force=False): """Load ignore and filtered word lists""" debug_print('Loading ignore list') if not IGNORE_LIST or force is True: global IGNORE_LIST IGNORE_LIST = [ line.lower().strip() for line in open(settings.ignore_list) ] debug_print('Loading filtered word list') if not FILTER_WORDS or force is True:...
else: save_id(settings.lastid,reply.id)
save_id(settings.lastid,reply.id)
def main(): auth = tweepy.BasicAuthHandler(username=settings.username, password=settings.password) api = tweepy.API(auth_handler=auth, secure=True, retry_count=3) last_id = get_last_id(settings.lastid) debug_print('Loading friends list') friends = api.friends_ids() debug_print('Friend list loaded, size: %d' % len(fri...
else: debug_print('Received smaller ID, not saving. Old: %d, New: %s' % ( last_id, id))
def save_id(statefile,id): """Save last status ID to a file""" last_id = get_last_id(statefile) if last_id < id: f = open(statefile,'w') f.write(str(id)) # no trailing newline f.close() # Don't need to do anything if for some reason the ID got smaller
pass
for fd, obj in asyncore.socket_map.items(): obj.close()
def main_func(): options = _parse_options() if options.message_filter: from utils import MessageMap MessageMap.set_filter(options.message_filter) os.chdir(options.root) try: run_proxy(options) except KeyboardInterrupt: # todo: shut down the open connections cleanly pass """ import cProfile, sys p=open("profile", "w") s...
msg = '["%s",%s,%s,%s,%s]' % (
message = '["%s",%s,%s,%s,%s]' % (
def handle_scope_message(self, msg): msg = '["%s",%s,%s,%s,%s]' % ( msg[1], # service msg[2], # command msg[4], # status msg[5], # tag msg[8], # payload ) if self.debug: pretty_print("send to client:", msg, self.debug_format, self.debug_format_payload) self.send_message(msg)
self.send_message(msg)
self.send_message(message)
def handle_scope_message(self, msg): msg = '["%s",%s,%s,%s,%s]' % ( msg[1], # service msg[2], # command msg[4], # status msg[5], # tag msg[8], # payload ) if self.debug: pretty_print("send to client:", msg, self.debug_format, self.debug_format_payload) self.send_message(msg)
return ''.join([chr((n >> 8 * (3 - i)) & 0xff) for i in range(4)])
return pack("!I", n)
def _get_number(self, in_str): n = int(''.join([i for i in in_str if i.isdigit()])) / in_str.count(' ') return ''.join([chr((n >> 8 * (3 - i)) & 0xff) for i in range(4)]) # throws DeprecationWarning: struct integer overflow masking is deprecated # for e.g. 2621808669 with Python 2.6.5 # return pack("!i", n & 0xffffffff...
print "%s%s: %s" % ( indent * INDENT, name, value)
try: print "%s%s: %s" % ( indent * INDENT, name, value) except: print "%s%s: %s%s" % ( indent * INDENT, name, value[0:100], '...')
def pretty_print_payload_item(indent, name, definition, item): if item and "message" in definition: print "%s%s:" % (indent * INDENT, name) pretty_print_payload(item, definition["message"], indent=indent+1) else: value = item if "enum" in definition: value = "%s (%s)" % (definition['enum']['numbers'][item], item) elif ...
self.PATH_INFO = self.REQUEST_URI[pos:]
path_info = self.REQUEST_URI[pos:] if "?" in path_info: path_info = path_info[0:path_info.find("?")] self.PATH_INFO = path_info
def check_is_cgi(self, system_path, handler=".cgi"): # system path of the cgi script self.cgi_script = "" self.SCRIPT_NAME = "" self.PATH_INFO = "" if handler in system_path: script_path = system_path[0:system_path.find(handler) + len(handler)] if isfile(script_path): self.cgi_script = script_path pos = self.REQUEST_UR...
headers_raw, first_line, self.headers, self.in_buffer = raw_parsed_headers
(headers_raw, first_line, self.headers, self.in_buffer) = raw_parsed_headers
def read_headers(self): raw_parsed_headers = parse_headers(self.in_buffer) if raw_parsed_headers: # to dispatch any hanging timeout response self.flush() headers_raw, first_line, self.headers, self.in_buffer = raw_parsed_headers method, path, protocol = first_line.split(BLANK, 2) self.REQUEST_URI = path path = path.lst...
if hasattr(self, command) and hasattr(getattr(self, command), '__call__'):
if hasattr(self, command) and \ hasattr(getattr(self, command), '__call__'):
def read_headers(self): raw_parsed_headers = parse_headers(self.in_buffer) if raw_parsed_headers: # to dispatch any hanging timeout response self.flush() headers_raw, first_line, self.headers, self.in_buffer = raw_parsed_headers method, path, protocol = first_line.split(BLANK, 2) self.REQUEST_URI = path path = path.lst...
environ["PATH_TRANSLATED"] = cwd + self.PATH_INFO.replace("/", os.path.sep)
environ["PATH_TRANSLATED"] = \ cwd + self.PATH_INFO.replace("/", os.path.sep)
def handle_cgi(self): import subprocess is_failed = False remote_addr, remote_port = self.socket.getpeername() cwd = os.getcwd() environ = { # os "COMSPEC": os.environ["COMSPEC"], "PATH": os.environ["PATH"], "PATHEXT": os.environ["PATHEXT"], "SYSTEMROOT": os.environ["SYSTEMROOT"], "WINDIR": os.environ["WINDIR"], # serv...
headers_raw, first_line, headers, content = raw_parsed_headers
(headers_raw, first_line, headers, content) = raw_parsed_headers
def handle_cgi(self): import subprocess is_failed = False remote_addr, remote_port = self.socket.getpeername() cwd = os.getcwd() environ = { # os "COMSPEC": os.environ["COMSPEC"], "PATH": os.environ["PATH"], "PATHEXT": os.environ["PATHEXT"], "SYSTEMROOT": os.environ["SYSTEMROOT"], "WINDIR": os.environ["WINDIR"], # serv...
response_code, response_token = headers.pop('Status').split(' ', 1)
response_code, response_token = \ headers.pop('Status').split(' ', 1)
def handle_cgi(self): import subprocess is_failed = False remote_addr, remote_port = self.socket.getpeername() cwd = os.getcwd() environ = { # os "COMSPEC": os.environ["COMSPEC"], "PATH": os.environ["PATH"], "PATHEXT": os.environ["PATHEXT"], "SYSTEMROOT": os.environ["SYSTEMROOT"], "WINDIR": os.environ["WINDIR"], # serv...
if problem_data["BCs"] != "null":
if problem_data["BCs"]:
def calc_global(problem_data): """ Calculates global stiffness matrix, assembly of elemental systems are included here instead of defining an extra function for assembly """ print("Calculating global system...") global NEN, NEN_range, functions, a, V1, V2, c, f, shape_funcs #Defining global variables NEN = problem_da...
get_supported_packages = urllib2.urlopen(url=packages_url)
try: get_supported_packages = urllib2.urlopen(url=packages_url) except urllib2.HTTPError, e: self._repository_status['support_status'] = "" self._repository_status['details'] = "" if e.code == 500: self._repository_status['support_status'] = \ ("Error connecting to repository (server side issues)") else: print str(e) ...
def check_dependencies(self): """ determines if current VisTrail will be supported by the repository's VisTrail server """
self._unrunnable_wfs = {}
def check_dependencies(self): """ determines if current VisTrail will be supported by the repository's VisTrail server """
'branch_from': "" if not branching else repository_vt_id,
'branched_from': "" if not branching else repository_vt_id,
def push_vistrail_to_repository(self, branching=False): """ uploads current VisTrail to web repository """
except:
except Exception, e: log(str(e))
def check_url(url): try: p = urlparse(url) h = HTTP(p[1]) h.putrequest('HEAD', p[2]) h.endheaders() if h.getreply()[0] == 200: return True else: return False except: return False
elif check_url(path_to_vistrails):
elif (not build_always or (build_always and check_url(path_to_vistrails))):
def check_url(url): try: p = urlparse(url) h = HTTP(p[1]) h.putrequest('HEAD', p[2]) h.endheaders() if h.getreply()[0] == 200: return True else: return False except: return False
generate_latex_error("%s is not a valid url nor a valid path to vistrails.py" %\ (path_to_vistrails)))
generate_latex_error("It is possible that %s is not a valid \ url nor a valid path to vistrails.py or that you don't have an internet connection \ and some workflows have the buildalways option. If you already have cached files, \ try removing the buildalways option from vistrails latex command" %\ (path_to_vistrails))...
def check_url(url): try: p = urlparse(url) h = HTTP(p[1]) h.putrequest('HEAD', p[2]) h.endheaders() if h.getreply()[0] == 200: return True else: return False except: return False
r = pkg.report_missing_module(mname, mnamespace)
r = None if pkg.can_handle_missing_modules(): r = pkg.handle_missing_module(controller, module_id, pipeline) d = get_descriptor(mpkg, mname, mnamespace)
def attempt_automatic_upgrade(controller, pipeline, module_id): """attempt_automatic_upgrade(module_id, pipeline): [Action]
d = get_descriptor(mpkg, mname, mnamespace)
def attempt_automatic_upgrade(controller, pipeline, module_id): """attempt_automatic_upgrade(module_id, pipeline): [Action]
try: port_type = PortSpec.port_type_map.inverse[port.type] s = reg.get_port_spec_from_descriptor(d, port.name, port_type) except Exception, e: import traceback traceback.print_exc() msg = ("%s connection to port %s of module %s " "does not exist." % \ (PortSpec.port_type_map.inverse[port.type], port.name, inval...
port_type = PortSpec.port_type_map.inverse[port.type] UpgradeWorkflowHandler.check_port_spec(invalid_module, port.name, port_type, d, port.sigstring)
def check_connection_port(port): try: port_type = PortSpec.port_type_map.inverse[port.type] s = reg.get_port_spec_from_descriptor(d, port.name, port_type)
try: reg_spec = reg.get_port_spec_from_descriptor(d, function.name, 'input') except: raise UpgradeWorkflowError('cannot find function "%s" for' 'upgrade' % function.name) if reg_spec.sigstring != function.sigstring: raise UpgradeWorkflowError('mismatch on function "%s"' % \ function.name)
UpgradeWorkflowHandler.check_port_spec(invalid_module, function.name, 'input', d, function.sigstring)
def check_connection_port(port): try: port_type = PortSpec.port_type_map.inverse[port.type] s = reg.get_port_spec_from_descriptor(d, port.name, port_type)
output_port_spec = \ src_module.get_port_spec(src_port, 'output')
if ((src_port, 'output')) in local_port_specs: output_port_spec = local_port_specs[(src_port, 'output')] else: output_port_spec = \ src_module.get_port_spec(src_port, 'output')
def create_new_connection(src_module, src_port, dst_module, dst_port): # spec -> name, type, signature output_port_id = controller.id_scope.getNewId(Port.vtType) if type(src_port) == type(""): output_port_spec = \ src_module.get_port_spec(src_port, 'output') output_port = Port(id=output_port_id, spec=output_port_spec, ...
input_port_spec = \ dst_module.get_port_spec(dst_port, 'input')
if ((dst_port, 'input')) in local_port_specs: input_port_spec = local_port_specs[(dst_port, 'input')] else: input_port_spec = \ dst_module.get_port_spec(dst_port, 'input')
def create_new_connection(src_module, src_port, dst_module, dst_port): # spec -> name, type, signature output_port_id = controller.id_scope.getNewId(Port.vtType) if type(src_port) == type(""): output_port_spec = \ src_module.get_port_spec(src_port, 'output') output_port = Port(id=output_port_id, spec=output_port_spec, ...
self.setWindowTitle('VisTrails messages')
self.setWindowTitle('VisTrails Messages')
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleC...
QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'),
QtCore.SIGNAL('currentItemChanged(QListWidgetItem *, QListWidgetItem *)'),
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleC...
self.msg_box = None self.resize(700, 400)
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleC...
buttons = QtGui.QHBoxLayout()
self.text = QtGui.QTextEdit() self.text.setReadOnly(True) self.text.hide() layout.addWidget(self.text) buttons = QtGui.QGridLayout()
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleC...
close = QtGui.QPushButton('&Hide', self)
leftbuttons = QtGui.QGridLayout() buttons.addLayout(leftbuttons, 0, 0, QtCore.Qt.AlignLeft) rightbuttons = QtGui.QGridLayout() buttons.addLayout(rightbuttons, 0, 1, QtCore.Qt.AlignRight) close = QtGui.QPushButton('&Close', self)
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleC...
buttons.addWidget(close)
leftbuttons.addWidget(close, 0, 0)
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleC...
details = QtGui.QPushButton('&Show details', self) details.setFixedWidth(120) buttons.addWidget(details) self.connect(details, QtCore.SIGNAL('clicked()'), self.details)
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleC...
buttons.addWidget(copy)
rightbuttons.addWidget(copy, 0, 0)
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleC...
buttons.addWidget(copyAll)
rightbuttons.addWidget(copyAll, 0, 1)
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleC...
def details(self): """ call showMessage on selected message """ items = self.list.selectedItems() if len(items)>0: self.showMessage(items[0])
self.msg_box = None self.itemQueue = [] self.resize(700, 400)
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleC...
def showMessage(self, item):
def showMessage(self, item, olditem):
def showMessage(self, item): """ show item data in a messagebox """ self.showMessageBox(str(item.data(32).toString()))
self.showMessageBox(str(item.data(32).toString()))
s = str(item.data(32).toString()) msgs = s.split('\n') msgs = [cgi.escape(i) for i in msgs] format = {'INFO': 'Message:', 'WARNING': 'Warning message:', 'CRITICAL': 'Critical message:'} text = '<HTML><BODY BGCOLOR=" text += '<H4>%s</H4>' % format.get(msgs[0], 'Message:') text += '<H4>%s<br></H4>' % msgs[3] text += '<t...
def showMessage(self, item): """ show item data in a messagebox """ self.showMessageBox(str(item.data(32).toString()))
def showMessageBox(self, s): s = str(s).strip()
def updateMessageBox(self, item): self.currentItem = item msg_box = self.msg_box s = str(item.data(32).toString())
def showMessageBox(self, s): s = str(s).strip() msgs = s.split('\n') if self.msg_box and self.msg_box.isVisible(): self.msg_box.close() msg_box = QtGui.QMessageBox(self.parent()) self.msg_box = msg_box if msgs[0] == "INFO": msg_box.setIcon(QtGui.QMessageBox.Information) msg_box.setWindowTitle("Information") elif msgs[0...
if self.msg_box and self.msg_box.isVisible(): self.msg_box.close() msg_box = QtGui.QMessageBox(self.parent()) self.msg_box = msg_box
def showMessageBox(self, s): s = str(s).strip() msgs = s.split('\n') if self.msg_box and self.msg_box.isVisible(): self.msg_box.close() msg_box = QtGui.QMessageBox(self.parent()) self.msg_box = msg_box if msgs[0] == "INFO": msg_box.setIcon(QtGui.QMessageBox.Information) msg_box.setWindowTitle("Information") elif msgs[0...
text = "Time: %s\n Location: %s\n Message:\n%s" % \ (msgs[1], msgs[2], '\n'.join(msgs[3:])) msg_box.setInformativeText('\n'.join(msgs[4:])) msg_box.setStandardButtons(QtGui.QMessageBox.Ok) msg_box.setDefaultButton(QtGui.QMessageBox.Ok) msg_box.setDetailedText(text) msg_box.show()
def showMessageBox(self, item): """ Displays the current message in a messagebox if a message is already shown the same message is shown again but with a "next message"-button """ msg_box = self.msg_box if not msg_box or not msg_box.isVisible(): self.old_msg_box = msg_box msg_box = QtGui.QMessageBox(self.parent()) se...
def showMessageBox(self, s): s = str(s).strip() msgs = s.split('\n') if self.msg_box and self.msg_box.isVisible(): self.msg_box.close() msg_box = QtGui.QMessageBox(self.parent()) self.msg_box = msg_box if msgs[0] == "INFO": msg_box.setIcon(QtGui.QMessageBox.Information) msg_box.setWindowTitle("Information") elif msgs[0...
if msgs[0] == "CRITICAL": self.showMessageBox(s)
def write(self, s):
count = self.list.count() if count: self.list.scrollToItem(self.list.item(count-1))
def showEvent(self, e): """closeEvent(e) -> None Event handler called when the dialog is about to close.""" count = self.list.count() if count: self.list.scrollToItem(self.list.item(count-1)) self.emit(QtCore.SIGNAL("messagesView(bool)"), True)
abstraction_files = [] thumbnail_files = [] vistrail = None if locator is None: vistrail = Vistrail()
from core.vistrail.vistrail import Vistrail abstraction_files = [] thumbnail_files = [] vistrail = None if locator is None: vistrail = Vistrail() else: res = locator.load() if type(res) == type(SaveBundle(None)): vistrail = res.vistrail abstraction_files.extend(res.abstractions) thumbnail_files.extend(res.thumbnails)
def load_vistrail(locator, is_abstraction=False): abstraction_files = [] thumbnail_files = [] vistrail = None if locator is None: vistrail = Vistrail() else: res = locator.load() if type(res) == type(SaveBundle(None)): vistrail = res.vistrail abstraction_files.extend(res.abstractions) thumbnail_files.extend(res.thumbna...
res = locator.load() if type(res) == type(SaveBundle(None)): vistrail = res.vistrail abstraction_files.extend(res.abstractions) thumbnail_files.extend(res.thumbnails) else: vistrail = res vistrail.is_abstraction = is_abstraction return (vistrail, abstraction_files, thumbnail_files)
vistrail = res vistrail.is_abstraction = is_abstraction return (vistrail, abstraction_files, thumbnail_files)
def load_vistrail(locator, is_abstraction=False): abstraction_files = [] thumbnail_files = [] vistrail = None if locator is None: vistrail = Vistrail() else: res = locator.load() if type(res) == type(SaveBundle(None)): vistrail = res.vistrail abstraction_files.extend(res.abstractions) thumbnail_files.extend(res.thumbna...
def is_image_stale(filename, host, port, db_name, vt_id): statinfo = os.stat(filename) image_time = datetime.fromtimestamp(statinfo.st_mtime) locator = DBLocator(host=host, port=int(port), database=db_name, user=db_read_user, passwd=db_read_pass, obj_id=int(vt_id), obj_type=None, connection_id=None) vt_mod_time = locat...
def get_vt_graph_png(self, host, port, db_name, vt_id, is_local=True): """get_vt_graph_png(host:str, port: str, db_name: str, vt_id:str) -> str Returns the relative url of the generated image """
is_image_stale(filename, host, port, db_name, vt_id)) and
self._is_image_stale(filename, host, port, db_name, vt_id)) and
def is_image_stale(filename, host, port, db_name, vt_id): statinfo = os.stat(filename) image_time = datetime.fromtimestamp(statinfo.st_mtime) locator = DBLocator(host=host, port=int(port), database=db_name, user=db_read_user, passwd=db_read_pass, obj_id=int(vt_id), obj_type=None, connection_id=None) vt_mod_time = locat...
is_image_stale(filename, host, port, db_name, vt_id)):
self._is_image_stale(filename, host, port, db_name, vt_id)):
def is_image_stale(filename, host, port, db_name, vt_id): statinfo = os.stat(filename) image_time = datetime.fromtimestamp(statinfo.st_mtime) locator = DBLocator(host=host, port=int(port), database=db_name, user=db_read_user, passwd=db_read_pass, obj_id=int(vt_id), obj_type=None, connection_id=None) vt_mod_time = locat...
os.path.exists(filepath) and not os.path.exists(filename)) and self.proxies_queue is not None):
(os.path.exists(filepath) and not os.path.exists(filename)) or self._is_image_stale(filename, host, port, db_name, vt_id)) and self.proxies_queue is not None):
def get_vt_graph_pdf(self, host, port, db_name, vt_id, is_local=True): """get_vt_graph_pdf(host:str, port: str, db_name: str, vt_id:str) -> str Returns the relative url of the generated image """
if not os.path.exists(filepath):
if (not os.path.exists(filepath) or (os.path.exists(filepath) and not os.path.exists(filename)) or self._is_image_stale(filename, host, port, db_name, vt_id)): if os.path.exists(filepath): shutil.rmtree(filepath)
def get_vt_graph_pdf(self, host, port, db_name, vt_id, is_local=True): """get_vt_graph_pdf(host:str, port: str, db_name: str, vt_id:str) -> str Returns the relative url of the generated image """
if not os.path.exists(filename):
def get_vt_graph_pdf(self, host, port, db_name, vt_id, is_local=True): """get_vt_graph_pdf(host:str, port: str, db_name: str, vt_id:str) -> str Returns the relative url of the generated image """
if (e.modifiers() & QtCore.Qt.ControlModifier or e.modifiers() & QtCore.Qt.ShiftModifier): e.ignore()
if e.modifiers() & QtCore.Qt.ControlModifier: if key == QtCore.Qt.Key_C or key == QtCore.Qt.Key_Insert: self.copy() elif key == QtCore.Qt.Key_V: cursor = self.textCursor() cursor.movePosition(QtGui.QTextCursor.End) cursor.clearSelection() self.setTextCursor(cursor) self.paste() elif key == QtCore.Qt.Key_A: self.selectA...
def keyPressEvent(self, e): """keyPressEvent(e) -> None Handle user input a key at a time.
def mousePressEvent(self, e): """mousePressEvent(e) -> None Keep the cursor after the last prompt. """ if e.button() == QtCore.Qt.LeftButton: self.selectMode = True QtGui.QTextEdit.mousePressEvent(self, e)
def focusNextPrevChild(self, next): """focusNextPrevChild(next) -> None Suppress tabbing to the next window in multi-line commands. """ if next and self.more: return 0 return QtGui.QTextEdit.focusNextPrevChild(self, next)
return
# def mousePressEvent(self, e):
self.flush_move_actions()
added_moves = self.flush_move_actions()
def flush_delayed_actions(self): start_version = self.current_version desc_key = Action.ANNOTATION_DESCRIPTION for action in self._delayed_actions: self.vistrail.add_action(action, start_version, self.current_session) # HACK to populate upgrade information if (action.has_annotation_with_key(desc_key) and action.get_ann...
translate_dict = {'DBGroup': {'workflow': update_workflow}}
translate_dict = {'DBGroup': {'workflow': update_workflow}, 'DBAction': {'operations': update_operations}}
def update_workflow(old_obj, translate_dict): return DBWorkflow.update_version(old_obj.db_workflow, translate_dict, DBWorkflow())
translate_dict = {'DBGroup': {'workflow': update_workflow}}
translate_dict = {'DBGroup': {'workflow': update_workflow}, 'DBWorkflow': {'modules': update_modules}}
def update_workflow(old_obj, translate_dict): return DBWorkflow.update_version(old_obj.db_workflow, translate_dict, DBWorkflow())
QtCore.SIGNAL('itemClicked(QListWidgetItem *)'), self.updateDBObjectsList) self.connect(self.connectionList,
def connectSignals(self): """ connectSignals() -> None Map signals between GUI components """ self.connect(self.cancelButton, QtCore.SIGNAL('clicked()'), self.reject) self.connect(self.openButton, QtCore.SIGNAL('clicked()'), self.accept) self.connect(self.addAct, QtCore.SIGNAL('triggered()'), self.showConnConfig) self...
app = gui.application.VistrailsApplication
def __init__(self, parent): QToolWindow.__init__(self, parent=parent) #locals() returns the original dictionary, not a copy as #the docs say app = gui.application.VistrailsApplication self.firstLocals = copy.copy(locals()) self.shell = QShell(self.firstLocals,None) self.setWidget(self.shell) self.setWindowTitle(self.sh...
app = gui.application.VistrailsApplication shell_conf = app.configuration.shell
conf = get_vistrails_configuration() shell_conf = conf.shell
def __init__(self, locals=None, parent=None): """Constructor.
self.setCurrentFont(font)
self.setFont(font)
def __init__(self, locals=None, parent=None): """Constructor.
isoutdated = httpfile.is_outdated(remoteHeader, localFile)
isoutdated = httpfile._is_outdated(remoteHeader, localFile)
def verify_wsdl(wsdlList): """verify_wsdl(wsdlList: list of urls) -> (list,list,list) This checks for the wsdls that need to be updated or the files need to be generated and splits them in 3 lists: files that are outdated, updated and ones that an error was generated. """ outdated_list = [] updated_list = [] error_li...
qt_super(QVersionTreeScene, self).keyPressEvent(event)
else: qt_super(QVersionTreeScene, self).keyPressEvent(event)
def keyPressEvent(self, event): """ keyPressEvent(event: QKeyEvent) -> None Capture 'Del', 'Backspace' for pruning versions when not editing a tag """ selectedItems = self.selectedItems() versions = [item.id for item in selectedItems if type(item)==QGraphicsVersionItem and not item.text.hasFocus()] if (self.controller...
def new_abstraction(name, vistrail, vt_fname=None, internal_version=-1L):
def new_abstraction(name, vistrail, vt_fname=None, internal_version=-1L, pipeline=None):
def new_abstraction(name, vistrail, vt_fname=None, internal_version=-1L): """make_abstraction(name: str, vistrail: (str or Vistrail), registry: ModuleRegistry, vt_fname: str, internal_version: long) -> type Creates a new VisTrails module that is a subclass of Abstraction according to the vistrail file provided and the...
internal_version: long) -> type
internal_version: long, pipeline: Pipeline) -> type
def new_abstraction(name, vistrail, vt_fname=None, internal_version=-1L): """make_abstraction(name: str, vistrail: (str or Vistrail), registry: ModuleRegistry, vt_fname: str, internal_version: long) -> type Creates a new VisTrails module that is a subclass of Abstraction according to the vistrail file provided and the...
pipeline = vistrail.getPipeline(internal_version) pipeline.ensure_modules_are_on_registry() pipeline.ensure_connection_specs()
if pipeline is None: pipeline = vistrail.getPipeline(internal_version) pipeline.validate()
def new_abstraction(name, vistrail, vt_fname=None, internal_version=-1L): """make_abstraction(name: str, vistrail: (str or Vistrail), registry: ModuleRegistry, vt_fname: str, internal_version: long) -> type Creates a new VisTrails module that is a subclass of Abstraction according to the vistrail file provided and the...
repository_vt_id, repository_creator):
repository_vt_id, repository_creator, is_local=True):
def add_vt_to_db(self, host, port, db_name, user, vt_filepath, filename, repository_vt_id, repository_creator): """add_vt_to_db(host:str, port:int, db_name:str, user:str, vt_filepath:str(or datastream), filename:str, repository_vt_id:int, repository_creator:str) -> (return_status, int) This will add a vistrail in vt_fi...
traceback.print_exc()
def add_vt_to_db(self, host, port, db_name, user, vt_filepath, filename, repository_vt_id, repository_creator): """add_vt_to_db(host:str, port:int, db_name:str, user:str, vt_filepath:str(or datastream), filename:str, repository_vt_id:int, repository_creator:str) -> (return_status, int) This will add a vistrail in vt_fi...
old_db_vt_id):
old_db_vt_id, is_local=True):
def merge_vt(self, host, port, db_name, user, new_vt_filepath, old_db_vt_id): """ Merge new_vt (new_vt_filepath) with current vt (old_db_vt_id)