commit/galaxy-central: jgoecks: Paramamonster polish: (1) size panels appropriately; (2) initialize tool form from saved data; (3) use constant for tile size; (4) bug fixes.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/447ed3a57217/ changeset: 447ed3a57217 user: jgoecks date: 2012-06-29 00:00:30 summary: Paramamonster polish: (1) size panels appropriately; (2) initialize tool form from saved data; (3) use constant for tile size; (4) bug fixes. affected #: 2 files diff -r 603e4ed98fa7cb3b3c47f71b3b77bedd67f50fea -r 447ed3a57217d5465758eeb720abad407cfe934c static/scripts/viz/paramamonster.js --- a/static/scripts/viz/paramamonster.js +++ b/static/scripts/viz/paramamonster.js @@ -112,6 +112,7 @@ this.set('tree_data', { name: 'Root', + id: node_id++, children: (params_samples.length !== 0 ? create_tree_data(params_samples, 0) : null) }); }, @@ -149,8 +150,11 @@ // Walk subtree starting at clicked node to get full list of settings. var get_settings = function(node, settings) { - // Add setting for this node. - settings[node.param.get('name')] = node.value; + // Add setting for this node. Root node does not have a param, + // however. + if (node.param) { + settings[node.param.get('name')] = node.value; + } if (!node.children) { // At leaf node: add param setting and return. @@ -244,14 +248,16 @@ ], initialize: function(options) { - // FIXME: find a better way to deal with needed URLs: - var track_config = _.extend({ - data_url: galaxy_paths.get('raw_data_url'), - converted_datasets_state_url: galaxy_paths.get('dataset_state_url') - }, options.track); - // HACK: remove prefs b/c they cause a redraw, which is not supported now. - delete track_config.mode; - this.set('track', object_from_template(track_config, {}, null)); + if (options.track) { + // FIXME: find a better way to deal with needed URLs: + var track_config = _.extend({ + data_url: galaxy_paths.get('raw_data_url'), + converted_datasets_state_url: galaxy_paths.get('dataset_state_url') + }, options.track); + // HACK: remove prefs b/c they cause a redraw, which is not supported now. + delete track_config.mode; + this.set('track', object_from_template(track_config, {}, null)); + } }, same_settings: function(a_track) { @@ -358,6 +364,8 @@ var ParamaMonsterTrackView = Backbone.View.extend({ tagName: 'tr', + TILE_LEN: 250, + initialize: function(options) { this.canvas_manager = options.canvas_manager; this.render(); @@ -382,10 +390,19 @@ { title: 'Settings', icon_class: 'gear track-settings', - on_click: function () { + on_click: function() { settings_div.toggle(); }, tipsy_config: { gravity: 's' } + }, + { + title: 'Remove', + icon_class: 'cross-circle', + on_click: function() { + self.$el.remove(); + $('.tipsy').remove(); + // TODO: remove track from viz collection. + } } ]); settings_td.prepend(icon_menu.$el); @@ -413,12 +430,12 @@ $.when(track.data_manager.data_is_ready()).then(function(data_ok) { // Draw tile for each region. regions.each(function(region, index) { - var resolution = region.length() / 300, + var resolution = region.length() / self.TILE_LEN, w_scale = 1/resolution, mode = 'Pack'; $.when(track.data_manager.get_data(region, mode, resolution, {})).then(function(tile_data) { var canvas = self.canvas_manager.new_canvas(); - canvas.width = 300; + canvas.width = self.TILE_LEN; canvas.height = track.get_canvas_height(tile_data, mode, w_scale, canvas.width); track.draw_tile(tile_data, canvas.getContext('2d'), mode, resolution, region, w_scale); $(tile_containers[index]).empty().append(canvas); @@ -473,9 +490,17 @@ })); } + sweep_inputs_row.insertAfter(single_input_row); + + if (input.get('in_ptree')) { + single_input_row.hide(); + } + else { + sweep_inputs_row.hide(); + } + // Fow now, assume parameter is included in tree to start. - sweep_inputs_row.insertAfter(single_input_row); - single_input_row.hide(); + // Add buttons for adding/removing parameter. var self = this, @@ -554,10 +579,14 @@ }, render: function() { - var tree_params = this.model.get_tree_params(); // Start fresh. this.$el.children().remove(); + var tree_params = this.model.get_tree_params(); + if (!tree_params.length) { + return; + } + // Set width, height based on params and samples. this.width = 100 * (2 + tree_params.length); this.height = 15 * this.model.get_num_leaves(); @@ -692,7 +721,8 @@ * Add track to model and view. */ add_track: function(pm_track) { - var self = this; + var self = this, + param_tree = this.model.get('parameter_tree'); self.model.add_track(pm_track); var track_view = new ParamaMonsterTrackView({ model: pm_track, @@ -701,7 +731,7 @@ track_view.on('run_on_dataset', self.run_tool_on_dataset, self); self.track_collection_container.append(track_view.$el); track_view.$el.hover(function() { - var settings_leaf = param_tree.get_leaf(settings); + var settings_leaf = param_tree.get_leaf(pm_track.get('settings')); var connected_node_ids = _.pluck(param_tree.get_connected_nodes(settings_leaf), 'id'); // TODO: can do faster with enter? @@ -736,26 +766,7 @@ settings: settings, regions: regions }); - self.model.add_track(pm_track); - var track_view = new ParamaMonsterTrackView({ - model: pm_track, - canvas_manager: self.canvas_manager - }); - track_view.on('run_on_dataset', self.run_tool_on_dataset, self); - self.track_collection_container.append(track_view.$el); - track_view.$el.hover(function() { - var settings_leaf = param_tree.get_leaf(settings); - var connected_node_ids = _.pluck(param_tree.get_connected_nodes(settings_leaf), 'id'); - - // TODO: can do faster with enter? - d3.select(self.tool_param_tree_view.$el[0]).selectAll("g.node") - .filter(function(d) { - return _.find(connected_node_ids, function(id) { return id === d.id; }) !== undefined; - }).style('fill', '#f00'); - }, - function() { - d3.select(self.tool_param_tree_view.$el[0]).selectAll("g.node").style('fill', '#000'); - }); + self.add_track(pm_track); return pm_track; }); @@ -763,7 +774,7 @@ _.each(tracks, function(pm_track, index) { setTimeout(function() { // Set inputs and run tool. - //console.log('running with settings', pm_track.get('settings')); + // console.log('running with settings', pm_track.get('settings')); tool.set_input_values(pm_track.get('settings')); $.when(tool.rerun(dataset, regions)).then(function(output) { // Create and add track for output dataset. diff -r 603e4ed98fa7cb3b3c47f71b3b77bedd67f50fea -r 447ed3a57217d5465758eeb720abad407cfe934c templates/visualization/paramamonster.mako --- a/templates/visualization/paramamonster.mako +++ b/templates/visualization/paramamonster.mako @@ -78,6 +78,16 @@ background-image: none; border-radius: 12px; } + #left { + width: 300px; + } + #center { + left: 300px; + right: 600px; + } + #right { + width: 600px; + } </style></%def> 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