LibreOffice のマクロを Python で書いた場合の、「OK」ボタンが1つだけのダイアログボックスと、「はい」「いいえ」の選択肢のあるダイヤログボックスの使い方。
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import uno
import datetime
import re
import os
CARD_DATA = '/data/number_cardid.csv'
class Bridge(object):
def __init__(self):
self._context = XSCRIPTCONTEXT.getComponentContext()
self._desktop = XSCRIPTCONTEXT.getDesktop()
self._frame = self._desktop.CurrentFrame
self._window = self._frame.ContainerWindow
self._toolkit = self._window.Toolkit
def run_infodialog(self,, message=''):
msgbox = self._toolkit.createMessageBox(self._window,
'infobox', # ヒントアイコン
1, # 「OK」ボタン
title,
message)
msgbox.execute()
msgbox.dispose()
def run_querydialog(self,, message=''):