Always show entry of URL widget in form
This allows to copy the URL without opening it even if it is readonly. Closes #1340
This commit is contained in:
+1
-12
@@ -4534,18 +4534,7 @@ function eval_pyson(value){
|
||||
},
|
||||
set_url: function(value) {
|
||||
this.button.attr('href', value);
|
||||
},
|
||||
set_readonly: function(readonly) {
|
||||
Sao.View.Form.URL._super.set_readonly.call(this, readonly);
|
||||
if (readonly) {
|
||||
this.input.hide();
|
||||
this.button.removeClass('btn-default');
|
||||
this.button.addClass('btn-link');
|
||||
} else {
|
||||
this.input.show();
|
||||
this.button.removeClass('btn-link');
|
||||
this.button.addClass('btn-default');
|
||||
}
|
||||
this.button.prop('disabled', !value);
|
||||
},
|
||||
set_invisible: function(invisible) {
|
||||
Sao.View.Form.URL._super.set_invisible.call(this, invisible);
|
||||
|
||||
+16
-4
@@ -3100,6 +3100,18 @@
|
||||
}
|
||||
});
|
||||
|
||||
Sao.View.EditableTree.URL = Sao.class_(Sao.View.EditableTree.Char, {
|
||||
class_: 'editable-url',
|
||||
set_readonly: function(readonly) {
|
||||
Sao.View.EditableTree.URL._super.set_readonly.call(this, readonly);
|
||||
if (readonly) {
|
||||
this.input.hide();
|
||||
} else {
|
||||
this.input.show();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Sao.View.EditableTree.Date = Sao.class_(Sao.View.Form.Date, {
|
||||
class_: 'editabletree-date',
|
||||
init: function(view, attributes) {
|
||||
@@ -3232,10 +3244,10 @@
|
||||
Sao.View.EditableTree.WIDGETS = {
|
||||
'binary': Sao.View.EditableTree.Binary,
|
||||
'boolean': Sao.View.EditableTree.Boolean,
|
||||
'callto': Sao.View.EditableTree.Char,
|
||||
'callto': Sao.View.EditableTree.URL,
|
||||
'char': Sao.View.EditableTree.Char,
|
||||
'date': Sao.View.EditableTree.Date,
|
||||
'email': Sao.View.EditableTree.Char,
|
||||
'email': Sao.View.EditableTree.URL,
|
||||
'float': Sao.View.EditableTree.Float,
|
||||
'integer': Sao.View.EditableTree.Integer,
|
||||
'many2many': Sao.View.EditableTree.Many2Many,
|
||||
@@ -3245,11 +3257,11 @@
|
||||
'one2one': Sao.View.EditableTree.One2One,
|
||||
'reference': Sao.View.EditableTree.Reference,
|
||||
'selection': Sao.View.EditableTree.Selection,
|
||||
'sip': Sao.View.EditableTree.Char,
|
||||
'sip': Sao.View.EditableTree.URL,
|
||||
'text': Sao.View.EditableTree.Char,
|
||||
'time': Sao.View.EditableTree.Time,
|
||||
'timedelta': Sao.View.EditableTree.TimeDelta,
|
||||
'url': Sao.View.EditableTree.Char,
|
||||
'url': Sao.View.EditableTree.URL,
|
||||
};
|
||||
|
||||
}());
|
||||
|
||||
@@ -45,6 +45,7 @@ class URL(Char):
|
||||
value = icon
|
||||
self.button.set_image(common.IconFactory.get_image(
|
||||
value, Gtk.IconSize.SMALL_TOOLBAR))
|
||||
self.button.set_sensitive(bool(self.entry.get_text()))
|
||||
|
||||
def set_tooltips(self):
|
||||
value = self.entry.get_text()
|
||||
@@ -55,14 +56,6 @@ class URL(Char):
|
||||
self.tooltips.set_tip(self.button, '')
|
||||
self.tooltips.disable()
|
||||
|
||||
def _readonly_set(self, value):
|
||||
super(URL, self)._readonly_set(value)
|
||||
if value:
|
||||
self.entry.hide()
|
||||
else:
|
||||
self.entry.show()
|
||||
self.button.set_sensitive(True)
|
||||
|
||||
def button_clicked(self, widget):
|
||||
value = self.entry.get_text()
|
||||
if value:
|
||||
|
||||
Reference in New Issue
Block a user