https://bz.apache.org/ooo/show_bug.cgi?id=107734
hanya <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #10 from hanya <[email protected]> --- It worked on Linux environment, Xubuntu 14.04. I used the following to generate mathml. http://formulasheet.com/editor.php Push "Copy MML" button on the left bottom corner of the window to copy the formula as MathML. Importing from the text contains MathML comming from the clipboard worked. But I could not find the application which push MathML into the clipboard on Linux environment now. So I tried to make one using pyGtk. First I tried to use the following mime-type for MathML: "application/mathml+xml". But it did not work with the mime-type. I needed to change it like: application/mathml+xml;windows_formatname=\"MathML\". Since the function works well with plain text, its not large problem. Here is the code to push MathML data to clipboard using pyGtk. Thanks for the work. The following code require pyGtk. -- import pygtk import gtk clipboard = gtk.clipboard_get() TEXT_MIME_TYPE = 'text/plain;charset=utf-8' MATHML_MIME_TYPE = 'application/mathml+xml;windows_formatname=\"MathML\"' targets = ( (TEXT_MIME_TYPE, 0, 0), (MATHML_MIME_TYPE, 0, 1), ) mathml_content = """<math xmlns="http://www.w3.org/1998/Math/MathML"> <mfrac><mi>a</mi><mi>b</mi></mfrac></math>""" def get_func(clipboard, selectiondata, info, user_data): print("get_func, info: " + str(info)) if info == 0: clipboard.set_text("text") elif info == 1: selectiondata.set(MATHML_MIME_TYPE, 8, mathml_content) def clear_func(clipboard, user_data): pass clipboard.set_with_data(targets, get_func, clear_func, None) # create dummy window class MainWindow(gtk.Window): def __init__(self, *args, **kwargs): gtk.Window.__init__(self, *args, **kwargs) class App: def main(self): win = MainWindow() win.show_all() gtk.main() App().main() -- You are receiving this mail because: You are on the CC list for the issue.
