def export_spreadsheet_activate(self): """Called when the Export menu item is activated""" if self.search_spec is None: raise NotImplementedError sse = SpreadSheetExporter() sse.export(object_list=self.results, name=self.app_name, filename_prefix=self.app_name)
def export_spreadsheet_activate(self): """Called when the Export menu item is activated""" if self.search_table is None: raise NotImplementedError sse = SpreadSheetExporter() sse.export(object_list=self.results, name=self.app_name, filename_prefix=self.app.name)
def _export_spreadsheet(self): """Runs a dialog to export the current search results to a CSV file. """ if self._is_accounts_tab(): run_dialog(FinancialReportDialog, self, self.store) else: page = self.get_current_page() sse = SpreadSheetExporter() sse.export(object_list=page.result_view, name=self.app_title, filename_prefix=self.app_name)
def export_spreadsheet_activate(self): """Called when the Export menu item is activated""" if self.search_spec is None: raise NotImplementedError model = self.results.get_model() if isinstance(model, LazyObjectModel): model.load_items_from_results(0, model._count) sse = SpreadSheetExporter() sse.export(object_list=self.results, name=self.app_name, filename_prefix=self.app_name)
def export_spreadsheet_activate(self): """Called when the Export menu item is activated""" if self.search_spec is None: raise NotImplementedError if api.sysparam.get_bool('SMART_LIST_LOADING'): model = self.results.get_model() model.load_items_from_results(0, model._count) sse = SpreadSheetExporter() sse.export(object_list=self.results, name=self.app_name, filename_prefix=self.app_name)
def _on_export_csv_button__clicked(self, widget): if not self.unlimited_results: executer = self.search.get_query_executer() data = executer.search(limit=-1) else: # The results are already unlimited, let the exporter get the data # from the objectlist data = None sse = SpreadSheetExporter() sse.export(object_list=self.results, data=data, name=self._csv_name, filename_prefix=self._csv_prefix)
def test_export_open(self): api.user_settings.set('spreadsheet-action', 'open') sse = SpreadSheetExporter() with mock.patch.object(sse, '_open_application') as _open: self._run_exporter(sse) self.assertTrue(_open.call_count, 1)
def _on_export_csv_button__clicked(self, widget): if not self.unlimited_results: # FIXME: This is making the filters set by the user be respected # when exporting the results. executer = self.search.get_query_executer() states = [(sf.get_state()) for sf in self.search.get_search_filters()] data = executer.search(states, limit=-1) else: # The results are already unlimited, let the exporter get the data # from the objectlist data = None sse = SpreadSheetExporter() sse.export(object_list=self.results, data=data, name=self._csv_name, filename_prefix=self._csv_prefix)
def confirm(self): start = self.date_filter.get_start_date() if start is None: warning(_("There are no transactions yet")) return f = FinancialIntervalReport(self.store, start.year) if not f.run(): return temporary = tempfile.NamedTemporaryFile( # Translators: This will be part of a filename prefix=_('stoq-yearly-report'), suffix='.xls', delete=False) f.write(temporary) sse = SpreadSheetExporter() sse.export_temporary(temporary) self.close()
def test_export_ask(self, yesno): # XXX: We should not be using yesno for a save/open question yesno.return_value = False api.user_settings.set('spreadsheet-action', 'ask') sse = SpreadSheetExporter() with mock.patch.object(sse, '_open_application') as _open: self._run_exporter(sse) self.assertTrue(_open.call_count, 1) yesno.assert_called_once_with( ('A spreadsheet has been created, what do ' 'you want to do with it?'), Gtk.ResponseType.NO, 'Save it to disk', 'Open with App Name')
def _on_export_csv_button__clicked(self, widget): sse = SpreadSheetExporter() sse.export(object_list=self.results, name=_("Fiscal book"), filename_prefix=_("fiscal-book"))
def _on_export_csv_button__clicked(self, widget): sse = SpreadSheetExporter() sse.export(object_list=self.results, name=_('Sales'), filename_prefix=_('sales'))
def _export_csv(self, object_list, name, filename_prefix): sse = SpreadSheetExporter() sse.export(object_list=object_list, name=name, filename_prefix=filename_prefix)
def _export_csv(self): sse = SpreadSheetExporter() sse.export(object_list=self.ordered_items, name=_('Purchase items'), filename_prefix=_('purchase-items'))
def _on_export_csv_button__clicked(self, widget): sse = SpreadSheetExporter() sse.export(object_list=self.results, name=_('Calls'), filename_prefix=_('calls'))
def on_export_button__clicked(self, button): sse = SpreadSheetExporter() sse.export(object_list=self.items_list, name=_('Purchase items'), filename_prefix=_('purchase-items'))
def on_csv_button__clicked(self, widget): sse = SpreadSheetExporter() sse.export(object_list=self.results, name=_('Brands'), filename_prefix=_('brands'))