+34
-16
@@ -1220,22 +1220,6 @@
|
||||
|
||||
this.fields = {};
|
||||
this.fields_model = {};
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-link',
|
||||
'type': 'button',
|
||||
'title': Sao.i18n.gettext("Cancel"),
|
||||
}).text(Sao.i18n.gettext('Cancel')).click(() => {
|
||||
this.response('RESPONSE_CANCEL');
|
||||
}).appendTo(this.dialog.footer);
|
||||
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-primary',
|
||||
'type': 'submit',
|
||||
'title': Sao.i18n.gettext("OK"),
|
||||
}).text(Sao.i18n.gettext('OK')).click(e => {
|
||||
e.preventDefault();
|
||||
this.response('RESPONSE_OK');
|
||||
}).appendTo(this.dialog.footer);
|
||||
|
||||
var row_fields = jQuery('<div/>', {
|
||||
'class': 'row'
|
||||
@@ -1420,6 +1404,23 @@
|
||||
Sao.Window.Import._super.init.call(this,
|
||||
Sao.i18n.gettext('CSV Import: %1', name));
|
||||
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-link',
|
||||
'type': 'button',
|
||||
'title': Sao.i18n.gettext("Cancel"),
|
||||
}).text(Sao.i18n.gettext("Cancel")).click(() => {
|
||||
this.response('RESPONSE_CANCEL');
|
||||
}).appendTo(this.dialog.footer);
|
||||
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-primary',
|
||||
'type': 'submit',
|
||||
'title': Sao.i18n.gettext("Import"),
|
||||
}).text(Sao.i18n.gettext("Import")).click(e => {
|
||||
e.preventDefault();
|
||||
this.response('RESPONSE_OK');
|
||||
}).appendTo(this.dialog.footer);
|
||||
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-default btn-block',
|
||||
'type': 'button',
|
||||
@@ -1758,6 +1759,23 @@
|
||||
Sao.Window.Export._super.init.call(this,
|
||||
Sao.i18n.gettext('CSV Export: %1',name));
|
||||
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-link',
|
||||
'type': 'button',
|
||||
'title': Sao.i18n.gettext("Close"),
|
||||
}).text(Sao.i18n.gettext("Close")).click(() => {
|
||||
this.response('RESPONSE_CLOSE');
|
||||
}).appendTo(this.dialog.footer);
|
||||
|
||||
jQuery('<button/>', {
|
||||
'class': 'btn btn-primary',
|
||||
'type': 'submit',
|
||||
'title': Sao.i18n.gettext("Save As..."),
|
||||
}).text(Sao.i18n.gettext("Save As...")).click(e => {
|
||||
e.preventDefault();
|
||||
this.response('RESPONSE_OK');
|
||||
}).appendTo(this.dialog.footer);
|
||||
|
||||
this.info_bar = new Sao.Window.InfoBar();
|
||||
this.dialog.body.append(this.info_bar.el);
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import sys
|
||||
from gi.repository import Gdk, GObject, Gtk
|
||||
|
||||
from tryton.common import IconFactory, RPCExecute
|
||||
from tryton.common.underline import set_underline
|
||||
from tryton.config import TRYTON_ICON
|
||||
from tryton.gui import Main
|
||||
from tryton.gui.window.nomodal import NoModal
|
||||
@@ -177,16 +176,6 @@ class WinCSV(NoModal):
|
||||
|
||||
self.add_csv_header_param(box)
|
||||
|
||||
button_cancel = self.dialog.add_button(
|
||||
set_underline(_("Cancel")), Gtk.ResponseType.CANCEL)
|
||||
button_cancel.set_image(IconFactory.get_image(
|
||||
'tryton-cancel', Gtk.IconSize.BUTTON))
|
||||
|
||||
button_ok = self.dialog.add_button(
|
||||
set_underline(_("OK")), Gtk.ResponseType.OK)
|
||||
button_ok.set_image(IconFactory.get_image(
|
||||
'tryton-ok', Gtk.IconSize.BUTTON))
|
||||
|
||||
self.dialog.vbox.pack_start(
|
||||
dialog_vbox, expand=True, fill=True, padding=0)
|
||||
|
||||
|
||||
@@ -14,7 +14,8 @@ from numbers import Number
|
||||
from gi.repository import Gdk, GObject, Gtk
|
||||
|
||||
import tryton.common as common
|
||||
from tryton.common import RPCException, RPCExecute, tempfile
|
||||
from tryton.common import IconFactory, RPCException, RPCExecute, tempfile
|
||||
from tryton.common.underline import set_underline
|
||||
from tryton.config import CONFIG
|
||||
from tryton.gui.window.win_csv import WinCSV
|
||||
from tryton.jsonrpc import JSONEncoder
|
||||
@@ -39,6 +40,17 @@ class WinExport(WinCSV, InfoBar):
|
||||
# Hide as selected record is the default
|
||||
self.ignore_search_limit.hide()
|
||||
|
||||
self.dialog.add_button(
|
||||
set_underline(_("Close")), Gtk.ResponseType.CANCEL).set_image(
|
||||
IconFactory.get_image('tryton-close', Gtk.IconSize.BUTTON))
|
||||
self.dialog.add_button(
|
||||
set_underline(_("Open")), Gtk.ResponseType.OK).set_image(
|
||||
IconFactory.get_image('tryton-open', Gtk.IconSize.BUTTON))
|
||||
self.dialog.add_button(
|
||||
set_underline(_("Save As...")), Gtk.ResponseType.ACCEPT).set_image(
|
||||
IconFactory.get_image('tryton-save', Gtk.IconSize.BUTTON))
|
||||
self.dialog.set_default_response(Gtk.ResponseType.OK)
|
||||
|
||||
@property
|
||||
def model(self):
|
||||
return self.screen.model_name
|
||||
@@ -117,12 +129,6 @@ class WinExport(WinCSV, InfoBar):
|
||||
def add_chooser(self, box):
|
||||
hbox_csv_export = Gtk.HBox()
|
||||
box.pack_start(hbox_csv_export, expand=False, fill=True, padding=0)
|
||||
self.saveas = Gtk.ComboBoxText()
|
||||
hbox_csv_export.pack_start(
|
||||
self.saveas, expand=True, fill=True, padding=3)
|
||||
self.saveas.append_text(_("Open"))
|
||||
self.saveas.append_text(_("Save"))
|
||||
self.saveas.set_active(0)
|
||||
|
||||
self.selected_records = Gtk.ComboBoxText()
|
||||
hbox_csv_export.pack_start(
|
||||
@@ -346,7 +352,7 @@ class WinExport(WinCSV, InfoBar):
|
||||
|
||||
def response(self, dialog, response):
|
||||
self.info_bar_clear()
|
||||
if response == Gtk.ResponseType.OK:
|
||||
if response in {Gtk.ResponseType.OK, Gtk.ResponseType.ACCEPT}:
|
||||
fields = []
|
||||
iter = self.model2.get_iter_first()
|
||||
while iter:
|
||||
@@ -390,7 +396,7 @@ class WinExport(WinCSV, InfoBar):
|
||||
except RPCException:
|
||||
data = []
|
||||
|
||||
if self.saveas.get_active():
|
||||
if response == Gtk.ResponseType.ACCEPT:
|
||||
fname = common.file_selection(_('Save As...'),
|
||||
action=Gtk.FileChooserAction.SAVE)
|
||||
if fname:
|
||||
|
||||
@@ -10,7 +10,8 @@ from decimal import Decimal
|
||||
from gi.repository import Gtk
|
||||
|
||||
import tryton.common as common
|
||||
from tryton.common import RPCException, RPCExecute
|
||||
from tryton.common import IconFactory, RPCException, RPCExecute
|
||||
from tryton.common.underline import set_underline
|
||||
from tryton.gui.window.win_csv import WinCSV
|
||||
|
||||
_ = gettext.gettext
|
||||
@@ -29,6 +30,16 @@ class WinImport(WinCSV):
|
||||
super(WinImport, self).__init__()
|
||||
self.dialog.set_title(_('CSV Import: %s') % name)
|
||||
|
||||
button_cancel = self.dialog.add_button(
|
||||
set_underline(_("Cancel")), Gtk.ResponseType.CANCEL)
|
||||
button_cancel.set_image(IconFactory.get_image(
|
||||
'tryton-cancel', Gtk.IconSize.BUTTON))
|
||||
|
||||
button_ok = self.dialog.add_button(
|
||||
set_underline(_("Import")), Gtk.ResponseType.OK)
|
||||
button_ok.set_image(IconFactory.get_image(
|
||||
'tryton-import', Gtk.IconSize.BUTTON))
|
||||
|
||||
def add_buttons(self, box):
|
||||
button_autodetect = Gtk.Button(
|
||||
label=_('_Auto-Detect'), stock=None, use_underline=True)
|
||||
|
||||
Reference in New Issue
Block a user