commit/galaxy-central: 2 new changesets
2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/05f017e906b3/ changeset: 05f017e906b3 user: jgoecks date: 2012-01-09 18:12:32 summary: Trackster: add icon that shows more features by increasing the number of rows shown. Update tipsy text in 'get more data' icons' to include message. affected #: 4 files diff -r 4a9f7ff4e2c02bf87d33590061e09ef4e70fb84e -r 05f017e906b33847b0d8ce50fcc3157ffa6ca0aa static/images/fugue/exclamation.png Binary file static/images/fugue/exclamation.png has changed diff -r 4a9f7ff4e2c02bf87d33590061e09ef4e70fb84e -r 05f017e906b33847b0d8ce50fcc3157ffa6ca0aa static/june_2007_style/blue/trackster.css --- a/static/june_2007_style/blue/trackster.css +++ b/static/june_2007_style/blue/trackster.css @@ -57,6 +57,7 @@ .layer-transparent.active{background:transparent url(../images/fugue/layer-transparent.png) no-repeat;} .arrow-resize-090{background:transparent url(../images/fugue/arrow-resize-090-bw.png) no-repeat;} .arrow-resize-090.active{background:transparent url(../images/fugue/arrow-resize-090.png) no-repeat;} +.exclamation{background:transparent url(../images/fugue/exclamation.png) no-repeat;} .layers-stack{background:transparent url(../images/fugue/layers-stack-bw.png) no-repeat;} .layers-stack:hover{background:transparent url(../images/fugue/layers-stack.png) no-repeat;} .chevron-expand{background:transparent url(../images/fugue/chevron-expand-bw.png) no-repeat;} diff -r 4a9f7ff4e2c02bf87d33590061e09ef4e70fb84e -r 05f017e906b33847b0d8ce50fcc3157ffa6ca0aa static/june_2007_style/trackster.css.tmpl --- a/static/june_2007_style/trackster.css.tmpl +++ b/static/june_2007_style/trackster.css.tmpl @@ -297,6 +297,9 @@ .menu-button { margin: 0px 4px 0px 4px; } +.exclamation{ + background: transparent url(../images/fugue/exclamation.png) no-repeat; +} .layer-transparent { background: transparent url(../images/fugue/layer-transparent-bw.png) no-repeat; } diff -r 4a9f7ff4e2c02bf87d33590061e09ef4e70fb84e -r 05f017e906b33847b0d8ce50fcc3157ffa6ca0aa static/scripts/trackster.js --- a/static/scripts/trackster.js +++ b/static/scripts/trackster.js @@ -2507,7 +2507,7 @@ }; extend(SummaryTreeTile.prototype, Tile.prototype); -var FeatureTrackTile = function(track, index, resolution, canvas, data, mode, message, feature_mapper) { +var FeatureTrackTile = function(track, index, resolution, canvas, data, w_scale, mode, message, all_slotted, feature_mapper) { // Attribute init. Tile.call(this, track, index, resolution, canvas, data); this.mode = mode; @@ -2515,40 +2515,60 @@ this.feature_mapper = feature_mapper; // Add message + action icons to tile's html. - if (this.message) { + if (this.message || !all_slotted) { var + tile = this; canvas = this.html_elt.children()[0], - message_div = $("<div/>").addClass("tile-message").text(this.message) + message_div = $("<div/>").addClass("tile-message") // -1 to account for border. - .css({'height': ERROR_PADDING-1, 'width': canvas.width}).prependTo(this.html_elt), - more_down_icon = $("<a href='javascript:void(0);'/>").addClass("icon more-down") - .attr("title", "Get more data including depth").tipsy( {gravity: 's'} ).appendTo(message_div), - more_across_icon = $("<a href='javascript:void(0);'/>").addClass("icon more-across") - .attr("title", "Get more data excluding depth").tipsy( {gravity: 's'} ).appendTo(message_div); + .css({'height': ERROR_PADDING-1, 'width': canvas.width}).prependTo(this.html_elt); + + // Handle when not all elements are slotted. + if (!all_slotted) { + var icon = $("<a href='javascript:void(0);'/>").addClass("icon exclamation") + .attr("title", "To minimize track height, not all features in this region are displayed. Click to display more.") + .tipsy( {gravity: 's'} ).appendTo(message_div) + .click(function () { + $(".tipsy").hide(); + tile.track.slotters[w_scale].max_rows *= 2; + tile.track.request_draw(true); + }); + } + + // Handle message; only message currently is that only the first N elements are displayed. + if (this.message) { + var + num_features = data.length, + more_down_icon = $("<a href='javascript:void(0);'/>").addClass("icon more-down") + .attr("title", "For speed, only the first " + num_features + " features in this region were obtained from server. Click to get more data including depth") + .tipsy( {gravity: 's'} ).appendTo(message_div), + more_across_icon = $("<a href='javascript:void(0);'/>").addClass("icon more-across") + .attr("title", "For speed, only the first " + num_features + " features in this region were obtained from server. Click to get more data excluding depth") + .tipsy( {gravity: 's'} ).appendTo(message_div); - // Set up actions for icons. - var tile = this; - more_down_icon.click(function() { - // Mark tile as stale, request more data, and redraw track. - tile.stale = true; - track.data_manager.get_more_data(tile.low, tile.high, track.mode, tile.resolution, {}, track.data_manager.DEEP_DATA_REQ); - $(".tipsy").hide(); - track.request_draw(); - }).dblclick(function(e) { - // Do not propogate as this would normally zoom in. - e.stopPropagation(); - }); + // Set up actions for icons. + more_down_icon.click(function() { + // Mark tile as stale, request more data, and redraw track. + tile.stale = true; + track.data_manager.get_more_data(tile.low, tile.high, track.mode, tile.resolution, {}, track.data_manager.DEEP_DATA_REQ); + $(".tipsy").hide(); + track.request_draw(); + }).dblclick(function(e) { + // Do not propogate as this would normally zoom in. + e.stopPropagation(); + }); - more_across_icon.click(function() { - // Mark tile as stale, request more data, and redraw track. - tile.stale = true; - track.data_manager.get_more_data(tile.low, tile.high, track.mode, tile.resolution, {}, track.data_manager.BROAD_DATA_REQ); - $(".tipsy").hide(); - track.request_draw(); - }).dblclick(function(e) { - // Do not propogate as this would normally zoom in. - e.stopPropagation(); - }); + more_across_icon.click(function() { + // Mark tile as stale, request more data, and redraw track. + tile.stale = true; + track.data_manager.get_more_data(tile.low, tile.high, track.mode, tile.resolution, {}, track.data_manager.BROAD_DATA_REQ); + $(".tipsy").hide(); + track.request_draw(); + }).dblclick(function(e) { + // Do not propogate as this would normally zoom in. + e.stopPropagation(); + }); + } } }; extend(FeatureTrackTile.prototype, Tile.prototype); @@ -4003,7 +4023,7 @@ var dummy_context = this.view.canvas_manager.dummy_context, slotter = this.slotters[level]; if (!slotter || (slotter.mode !== mode)) { - slotter = new (slotting.FeatureSlotter)( level, mode === "Pack", MAX_FEATURE_DEPTH, function ( x ) { return dummy_context.measureText( x ) } ); + slotter = new (slotting.FeatureSlotter)( level, mode, MAX_FEATURE_DEPTH, function ( x ) { return dummy_context.measureText( x ) } ); this.slotters[level] = slotter; } @@ -4188,8 +4208,11 @@ // Handle row-by-row tracks - // Filter features. - var filtered = []; + // Preprocessing: filter features and determine whether all unfiltered features have been slotted. + var + filtered = [], + slots = this.slotters[w_scale].slots; + all_slotted = true; if ( result.data ) { var filters = this.filters_manager.filters; for (var i = 0, len = result.data.length; i < len; i++) { @@ -4205,7 +4228,12 @@ } } if (!hide_feature) { + // Feature visible. filtered.push(feature); + // Set flag if not slotted. + if ( !(feature[0] in slots) ) { + all_slotted = false; + } } } } @@ -4226,12 +4254,11 @@ if (result.data) { // Draw features. - slots = this.slotters[w_scale].slots; feature_mapper = painter.draw(ctx, canvas.width, canvas.height, w_scale, slots); feature_mapper.translation = -left_offset; } - return new FeatureTrackTile(track, tile_index, resolution, canvas, result.data, mode, result.message, feature_mapper); + return new FeatureTrackTile(track, tile_index, resolution, canvas, result.data, w_scale, mode, result.message, all_slotted, feature_mapper); }, /** * Returns true if data is compatible with a given mode. @@ -4342,11 +4369,12 @@ * This implementation is incremental, any feature assigned a slot will be * retained for slotting future features. */ -exports.FeatureSlotter = function (w_scale, include_label, max_rows, measureText) { +exports.FeatureSlotter = function (w_scale, mode, max_rows, measureText) { this.slots = {}; this.start_end_dct = {}; this.w_scale = w_scale; - this.include_label = include_label; + this.mode = mode; + this.include_label = (mode === "Pack"); this.max_rows = max_rows; this.measureText = measureText; }; https://bitbucket.org/galaxy/galaxy-central/changeset/2acedad2ef87/ changeset: 2acedad2ef87 user: jgoecks date: 2012-01-09 18:12:49 summary: Merge. affected #: 4 files diff -r 05f017e906b33847b0d8ce50fcc3157ffa6ca0aa -r 2acedad2ef87c907975dd5afab5eef9ccde31987 lib/galaxy/app.py --- a/lib/galaxy/app.py +++ b/lib/galaxy/app.py @@ -70,6 +70,8 @@ self.update_manager = update_manager.UpdateManager( self ) # Manage installed tool shed repositories self.installed_repository_manager = galaxy.tool_shed.InstalledRepositoryManager( self ) + # Load datatype display applications defined in local datatypes_conf.xml + self.datatypes_registry.load_display_applications() # Load datatype converters defined in local datatypes_conf.xml self.datatypes_registry.load_datatype_converters( self.toolbox ) # Load history import/export tools diff -r 05f017e906b33847b0d8ce50fcc3157ffa6ca0aa -r 2acedad2ef87c907975dd5afab5eef9ccde31987 lib/galaxy/datatypes/registry.py --- a/lib/galaxy/datatypes/registry.py +++ b/lib/galaxy/datatypes/registry.py @@ -28,19 +28,28 @@ self.set_external_metadata_tool = None self.sniff_order = [] self.upload_file_formats = [] + # Datatype elements defined in local datatypes_conf.xml + # that contain display applications + self.display_app_containers = [] + # Datatype elements in datatypes_conf.xml included in installed + # tool shed repositories that contain display applications + self.proprietary_display_app_containers = [] # Map a display application id to a display application self.display_applications = odict() + # The following 2 attributes are used in the to_xml_file() + # method to persist the current state into an xml file. + self.display_path_attr = None self.converters_path_attr = None # The 'default' converters_path defined in local datatypes_conf.xml - self.datatype_converters_path = None + self.converters_path = None # The 'default' display_path defined in local datatypes_conf.xml self.display_applications_path = None + self.inherit_display_application_by_class = [] self.datatype_elems = [] self.sniffer_elems = [] self.xml_filename = None def load_datatypes( self, root_dir=None, config=None, imported_modules=None ): if root_dir and config: - inherit_display_application_by_class = [] # Parse datatypes_conf.xml tree = galaxy.util.parse_xml( config ) root = tree.getroot() @@ -48,11 +57,11 @@ self.log.debug( 'Loading datatypes from %s' % config ) registration = root.find( 'registration' ) # Set default paths defined in local datatypes_conf.xml. - if not self.datatype_converters_path: + if not self.converters_path: self.converters_path_attr = registration.get( 'converters_path', 'lib/galaxy/datatypes/converters' ) - self.datatype_converters_path = os.path.join( root_dir, self.converters_path_attr ) - if not os.path.isdir( self.datatype_converters_path ): - raise ConfigurationError( "Directory does not exist: %s" % self.datatype_converters_path ) + self.converters_path = os.path.join( root_dir, self.converters_path_attr ) + if not os.path.isdir( self.converters_path ): + raise ConfigurationError( "Directory does not exist: %s" % self.converters_path ) if not self.display_applications_path: self.display_path_attr = registration.get( 'display_path', 'display_applications' ) self.display_applications_path = os.path.join( root_dir, self.display_path_attr ) @@ -60,7 +69,7 @@ # Keep an in-memory list of datatype elems to enable persistence. self.datatype_elems.append( elem ) try: - extension = elem.get( 'extension', None ) + extension = elem.get( 'extension', None ) dtype = elem.get( 'type', None ) type_extension = elem.get( 'type_extension', None ) mimetype = elem.get( 'mimetype', None ) @@ -128,30 +137,14 @@ mimetype = composite_file.get( 'mimetype', None ) self.datatypes_by_extension[extension].add_composite_file( name, optional=optional, mimetype=mimetype ) for display_app in elem.findall( 'display' ): - display_file = os.path.join( self.display_applications_path, display_app.get( 'file', None ) ) - try: - inherit = galaxy.util.string_as_bool( display_app.get( 'inherit', 'False' ) ) - display_app = DisplayApplication.from_file( display_file, self ) - if display_app: - if display_app.id in self.display_applications: - #if we already loaded this display application, we'll use the first one again - display_app = self.display_applications[ display_app.id ] - self.log.debug( "Loaded display application '%s' for datatype '%s', inherit=%s" % ( display_app.id, extension, inherit ) ) - self.display_applications[ display_app.id ] = display_app #Display app by id - self.datatypes_by_extension[ extension ].add_display_application( display_app ) - if inherit and ( self.datatypes_by_extension[extension], display_app ) not in inherit_display_application_by_class: - #subclass inheritance will need to wait until all datatypes have been loaded - inherit_display_application_by_class.append( ( self.datatypes_by_extension[extension], display_app ) ) - except: - self.log.exception( "error reading display application from path: %s" % display_file ) + if imported_modules: + if elem not in self.proprietary_display_app_containers: + self.proprietary_display_app_containers.append( elem ) + else: + if elem not in self.display_app_containers: + self.display_app_containers.append( elem ) except Exception, e: self.log.warning( 'Error loading datatype "%s", problem: %s' % ( extension, str( e ) ) ) - # Handle display_application subclass inheritance here: - for ext, d_type1 in self.datatypes_by_extension.iteritems(): - for d_type2, display_app in inherit_display_application_by_class: - current_app = d_type1.get_display_application( display_app.id, None ) - if current_app is None and isinstance( d_type1, type( d_type2 ) ): - d_type1.add_display_application( display_app ) # Load datatype sniffers from the config sniffers = root.find( 'sniffers' ) if sniffers: @@ -339,7 +332,7 @@ if converter_path: config_path = os.path.join( converter_path, tool_config ) else: - config_path = os.path.join( self.datatype_converters_path, tool_config ) + config_path = os.path.join( self.converters_path, tool_config ) try: converter = toolbox.load_tool( config_path ) toolbox.tools_by_id[ converter.id ] = converter @@ -348,7 +341,44 @@ self.datatype_converters[ source_datatype ][ target_datatype ] = converter self.log.debug( "Loaded converter: %s", converter.id ) except Exception, e: - self.log.exception( "Error loading converter (%s): %s" % ( converter_path, str( e ) ) ) + self.log.exception( "Error loading converter (%s): %s" % ( config_path, str( e ) ) ) + def load_display_applications( self, display_path=None ): + if display_path: + # Load display applications defined by datatypes_conf.xml + # included in installed tool shed repository. + datatype_elems = self.proprietary_display_app_containers + else: + # Load display applications defined by local datatypes_conf.xml. + datatype_elems = self.display_app_containers + for elem in datatype_elems: + extension = elem.get( 'extension', None ) + for display_app in elem.findall( 'display' ): + display_file = display_app.get( 'file', None ) + if display_path: + config_path = os.path.join( display_path, display_file ) + else: + config_path = os.path.join( self.display_applications_path, display_file ) + try: + inherit = galaxy.util.string_as_bool( display_app.get( 'inherit', 'False' ) ) + display_app = DisplayApplication.from_file( config_path, self ) + if display_app: + if display_app.id in self.display_applications: + # If we already loaded this display application, we'll use the first one loaded. + display_app = self.display_applications[ display_app.id ] + self.log.debug( "Loaded display application '%s' for datatype '%s', inherit=%s" % ( display_app.id, extension, inherit ) ) + self.display_applications[ display_app.id ] = display_app + self.datatypes_by_extension[ extension ].add_display_application( display_app ) + if inherit and ( self.datatypes_by_extension[ extension ], display_app ) not in self.inherit_display_application_by_class: + self.inherit_display_application_by_class.append( ( self.datatypes_by_extension[extension], display_app ) ) + except Exception, e: + self.log.exception( "Error loading display application (%s): %s" % ( config_path, str( e ) ) ) + # Handle display_application subclass inheritance. + for extension, d_type1 in self.datatypes_by_extension.iteritems(): + for d_type2, display_app in self.inherit_display_application_by_class: + current_app = d_type1.get_display_application( display_app.id, None ) + if current_app is None and isinstance( d_type1, type( d_type2 ) ): + self.log.debug( "Adding inherited display application '%s' to datatype '%s'" % ( display_app.id, extension ) ) + d_type1.add_display_application( display_app ) def load_external_metadata_tool( self, toolbox ): """Adds a tool which is used to set external metadata""" #we need to be able to add a job to the queue to set metadata. The queue will currently only accept jobs with an associated tool. diff -r 05f017e906b33847b0d8ce50fcc3157ffa6ca0aa -r 2acedad2ef87c907975dd5afab5eef9ccde31987 lib/galaxy/tool_shed/__init__.py --- a/lib/galaxy/tool_shed/__init__.py +++ b/lib/galaxy/tool_shed/__init__.py @@ -23,9 +23,11 @@ path_items = datatypes_config.split( 'repos' ) relative_install_dir = '%srepos/%s/%s/%s' % \ ( path_items[0], tool_shed_repository.owner, tool_shed_repository.name, tool_shed_repository.installed_changeset_revision ) - converter_path = load_datatypes( self.app, datatypes_config, relative_install_dir ) + converter_path, display_path = load_datatypes( self.app, datatypes_config, relative_install_dir ) if converter_path: # Load proprietary datatype converters self.app.datatypes_registry.load_datatype_converters( self.app.toolbox, converter_path=converter_path ) - # TODO: handle display_applications - \ No newline at end of file + if display_path: + # Load proprietary datatype display applications + app.datatypes_registry.load_display_applications( display_path=display_path ) + \ No newline at end of file diff -r 05f017e906b33847b0d8ce50fcc3157ffa6ca0aa -r 2acedad2ef87c907975dd5afab5eef9ccde31987 lib/galaxy/util/shed_util.py --- a/lib/galaxy/util/shed_util.py +++ b/lib/galaxy/util/shed_util.py @@ -449,7 +449,10 @@ # Parse datatypes_config. tree = util.parse_xml( datatypes_config ) datatypes_config_root = tree.getroot() + # Path to datatype converters converter_path = None + # Path to datatype display applications + display_path = None relative_path_to_datatype_file_name = None datatype_files = datatypes_config_root.find( 'datatype_files' ) datatype_class_modules = [] @@ -500,14 +503,13 @@ log.debug( "Exception importing datatypes code file %s: %s" % ( str( relative_path_to_datatype_file_name ), str( e ) ) ) finally: lock.release() - # Handle data type converters. + # Handle data type converters and display applications. for elem in registration.findall( 'datatype' ): if not converter_path: # If any of the <datatype> tag sets contain <converter> tags, set the converter_path - # if it is not already set. This requires repsitories to place all converters in the + # if it is not already set. This requires developers to place all converters in the # same subdirectory within the repository hierarchy. for converter in elem.findall( 'converter' ): - converter_path = None converter_config = converter.get( 'file', None ) if converter_config: for root, dirs, files in os.walk( relative_install_dir ): @@ -518,9 +520,23 @@ break if converter_path: break - else: + if not display_path: + # If any of the <datatype> tag sets contain <display> tags, set the display_path + # if it is not already set. This requires developers to place all display acpplications + # in the same subdirectory within the repository hierarchy. + for display_app in elem.findall( 'display' ): + display_config = display_app.get( 'file', None ) + if display_config: + for root, dirs, files in os.walk( relative_install_dir ): + if root.find( '.hg' ) < 0: + for name in files: + if name == display_config: + display_path = root + break + if display_path: + break + if converter_path and display_path: break - # TODO: handle display_applications else: # The repository includes a dataypes_conf.xml file, but no code file that # contains data type classes. This implies that the data types in datayptes_conf.xml @@ -528,7 +544,7 @@ imported_modules = [] # Load proprietary datatypes app.datatypes_registry.load_datatypes( root_dir=app.config.root, config=datatypes_config, imported_modules=imported_modules ) - return converter_path + return converter_path, display_path def load_repository_contents( app, name, description, owner, changeset_revision, tool_path, repository_clone_url, relative_install_dir, current_working_dir, tmp_name, tool_section=None, shed_tool_conf=None, new_install=True ): # This method is used by the InstallManager, which does not have access to trans. @@ -544,11 +560,13 @@ if 'datatypes_config' in metadata_dict: datatypes_config = os.path.abspath( metadata_dict[ 'datatypes_config' ] ) # Load data types required by tools. - converter_path = load_datatypes( app, datatypes_config, relative_install_dir ) + converter_path, display_path = load_datatypes( app, datatypes_config, relative_install_dir ) if converter_path: # Load proprietary datatype converters app.datatypes_registry.load_datatype_converters( app.toolbox, converter_path=converter_path ) - # TODO: handle display_applications + if display_path: + # Load proprietary datatype display applications + app.datatypes_registry.load_display_applications( display_path=display_path ) if 'tools' in metadata_dict: repository_tools_tups = [] for tool_dict in metadata_dict[ 'tools' ]: Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket