Commit 617aad4a authored by Daniel Brötzmann's avatar Daniel Brötzmann Committed by Philipp Hörist

HistorySync: Slight layout changes

parent 97d8b529
Pipeline #3777 passed with stages
in 3 minutes and 12 seconds
...@@ -218,11 +218,11 @@ def on_blocking_list(action, param): ...@@ -218,11 +218,11 @@ def on_blocking_list(action, param):
def on_history_sync(action, param): def on_history_sync(action, param):
account = param.get_string() account = param.get_string()
if 'history_sync' in interface.instances[account]: window = app.get_app_window(HistorySyncAssistant, account)
interface.instances[account]['history_sync'].present() if window is None:
HistorySyncAssistant(account, interface.roster.window)
else: else:
interface.instances[account]['history_sync'] = \ window.present()
HistorySyncAssistant(account, interface.roster.window)
def on_privacy_lists(action, param): def on_privacy_lists(action, param):
......
...@@ -61,8 +61,9 @@ popover#EmoticonPopover { padding: 5px; background-color: @theme_unfocused_base_ ...@@ -61,8 +61,9 @@ popover#EmoticonPopover { padding: 5px; background-color: @theme_unfocused_base_
.emoji-modifier-chooser-flowbox { padding-left: 5px; } .emoji-modifier-chooser-flowbox { padding-left: 5px; }
/* HistorySyncAssistant */ /* HistorySyncAssistant */
#HistorySyncAssistant list { border: 1px solid; border-color: @borders; } #HistorySyncAssistant notebook { padding: 18px; }
#HistorySyncAssistant progressbar text { color: #000; font-size: 18px; padding: 10px;} #HistorySyncAssistant progressbar text { color: #000; font-size: 18px; padding: 10px;}
#HistorySyncAssistant list { border: 1px solid; border-color: @borders; }
#HistorySyncAssistant list > row { padding: 10px 30px 10px 30px; } #HistorySyncAssistant list > row { padding: 10px 30px 10px 30px; }
#HistorySyncAssistant list > row > label { color: @insensitive_fg_color } #HistorySyncAssistant list > row > label { color: @insensitive_fg_color }
#HistorySyncAssistant list > row.activatable > label { color: @theme_text_color; } #HistorySyncAssistant list > row.activatable > label { color: @theme_text_color; }
......
...@@ -38,11 +38,13 @@ class Pages(IntEnum): ...@@ -38,11 +38,13 @@ class Pages(IntEnum):
class HistorySyncAssistant(Gtk.Assistant): class HistorySyncAssistant(Gtk.Assistant):
def __init__(self, account, parent): def __init__(self, account, parent):
Gtk.Assistant.__init__(self) Gtk.Assistant.__init__(self)
# self.set_title(_('Synchronise History')) self.set_application(app.app)
self.set_resizable(False) self.set_position(Gtk.WindowPosition.CENTER)
self.set_default_size(300, -1)
self.set_name('HistorySyncAssistant') self.set_name('HistorySyncAssistant')
self.set_default_size(300, -1)
self.set_resizable(False)
self.set_transient_for(parent) self.set_transient_for(parent)
self.account = account self.account = account
self.con = app.connections[self.account] self.con = app.connections[self.account]
self.timedelta = None self.timedelta = None
...@@ -51,7 +53,8 @@ class HistorySyncAssistant(Gtk.Assistant): ...@@ -51,7 +53,8 @@ class HistorySyncAssistant(Gtk.Assistant):
self.start = None self.start = None
self.end = None self.end = None
self.next = None self.next = None
self.hide_buttons()
self._hide_buttons()
own_jid = self.con.get_own_jid().getStripped() own_jid = self.con.get_own_jid().getStripped()
...@@ -92,18 +95,19 @@ class HistorySyncAssistant(Gtk.Assistant): ...@@ -92,18 +95,19 @@ class HistorySyncAssistant(Gtk.Assistant):
ged.PRECORE, ged.PRECORE,
self._nec_mam_message_received) self._nec_mam_message_received)
self.connect('prepare', self.on_page_change) self.connect('prepare', self._on_page_change)
self.connect('destroy', self.on_destroy) self.connect('destroy', self._on_destroy)
self.connect("cancel", self.on_close_clicked) self.connect('cancel', self._on_close_clicked)
self.connect("close", self.on_close_clicked) self.connect('close', self._on_close_clicked)
if mam_start == ArchiveState.ALL: if mam_start == ArchiveState.ALL:
self.set_current_page(Pages.SUMMARY) self.set_current_page(Pages.SUMMARY)
self.summary.nothing_to_do() self.summary.nothing_to_do()
self.show_all() self.show_all()
self.set_title(_('Synchronise History'))
def hide_buttons(self): def _hide_buttons(self):
''' '''
Hide some of the standard buttons that are included in Gtk.Assistant Hide some of the standard buttons that are included in Gtk.Assistant
''' '''
...@@ -125,15 +129,15 @@ class HistorySyncAssistant(Gtk.Assistant): ...@@ -125,15 +129,15 @@ class HistorySyncAssistant(Gtk.Assistant):
def _on_show_button(button): def _on_show_button(button):
button.hide() button.hide()
def prepare_query(self): def _prepare_query(self):
if self.timedelta: if self.timedelta:
self.start = self.now - self.timedelta self.start = self.now - self.timedelta
self.end = self.current_start self.end = self.current_start
log.info('get mam_start_date: %s', self.current_start) log.info('Get mam_start_date: %s', self.current_start)
log.info('now: %s', self.now) log.info('Now: %s', self.now)
log.info('start: %s', self.start) log.info('Start: %s', self.start)
log.info('end: %s', self.end) log.info('End: %s', self.end)
self.query_id = self.con.get_module('MAM').request_archive_count( self.query_id = self.con.get_module('MAM').request_archive_count(
self.start, self.end) self.start, self.end)
...@@ -151,7 +155,7 @@ class HistorySyncAssistant(Gtk.Assistant): ...@@ -151,7 +155,7 @@ class HistorySyncAssistant(Gtk.Assistant):
if event.query_id != self.query_id: if event.query_id != self.query_id:
return return
self.query_id = None self.query_id = None
log.info('query finished') log.info('Query finished')
GLib.idle_add(self.download_history.finished) GLib.idle_add(self.download_history.finished)
self.set_current_page(Pages.SUMMARY) self.set_current_page(Pages.SUMMARY)
self.summary.finished() self.summary.finished()
...@@ -165,7 +169,7 @@ class HistorySyncAssistant(Gtk.Assistant): ...@@ -165,7 +169,7 @@ class HistorySyncAssistant(Gtk.Assistant):
if queryid != self.query_id: if queryid != self.query_id:
return return
log.debug('received message') log.debug('Received message')
GLib.idle_add(self.download_history.set_fraction) GLib.idle_add(self.download_history.set_fraction)
def on_row_selected(self, listbox, row): def on_row_selected(self, listbox, row):
...@@ -175,12 +179,13 @@ class HistorySyncAssistant(Gtk.Assistant): ...@@ -175,12 +179,13 @@ class HistorySyncAssistant(Gtk.Assistant):
else: else:
self.set_page_complete(self.select_time, False) self.set_page_complete(self.select_time, False)
def on_page_change(self, assistant, page): def _on_page_change(self, assistant, page):
if page == self.download_history: if page == self.download_history:
self.next.hide() self.next.hide()
self.prepare_query() self._prepare_query()
self.set_title(_('Synchronise History'))
def on_destroy(self, *args): def _on_destroy(self, *args):
app.ged.remove_event_handler('archiving-count-received', app.ged.remove_event_handler('archiving-count-received',
ged.GUI1, ged.GUI1,
self._received_count) self._received_count)
...@@ -190,9 +195,8 @@ class HistorySyncAssistant(Gtk.Assistant): ...@@ -190,9 +195,8 @@ class HistorySyncAssistant(Gtk.Assistant):
app.ged.remove_event_handler('raw-mam-message-received', app.ged.remove_event_handler('raw-mam-message-received',
ged.PRECORE, ged.PRECORE,
self._nec_mam_message_received) self._nec_mam_message_received)
del app.interface.instances[self.account]['history_sync']
def on_close_clicked(self, *args): def _on_close_clicked(self, *args):
self.destroy() self.destroy()
...@@ -201,7 +205,8 @@ class SelectTimePage(Gtk.Box): ...@@ -201,7 +205,8 @@ class SelectTimePage(Gtk.Box):
super().__init__(orientation=Gtk.Orientation.VERTICAL) super().__init__(orientation=Gtk.Orientation.VERTICAL)
self.set_spacing(18) self.set_spacing(18)
self.assistant = assistant self.assistant = assistant
label = Gtk.Label(label=_('How far back do you want to go?')) label = Gtk.Label(
label=_('How far back do you want to synchronize chat history?'))
listbox = Gtk.ListBox() listbox = Gtk.ListBox()
listbox.set_hexpand(False) listbox.set_hexpand(False)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment