LibreOffice plugin to pipe whole Writer documents through Google Translate, that ought to keep most of the page formatting.

⌈⌋ ⎇ branch:  PageTranslate


Check-in [069fe7a49b]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add bugreport link to exception dialog
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 069fe7a49be8cba955fb47e1abfec0395c62191e
User & Date: mario 2021-05-12 20:30:32
Context
2021-05-12
20:31
Prepare DeepL free API (albeit probably broken), and deep-translate pacakge, also allow more shell-like placeholders for CLI usage and fix for Python 2.7 support. check-in: d8bb91403f user: mario tags: trunk, 1.7
20:30
Add bugreport link to exception dialog check-in: 069fe7a49b user: mario tags: trunk
05:02
mark as 1.6.90 check-in: f115d0bf81 user: mario tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to off/exceptions.xdl.

1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="exceptions" dlg:left="135" dlg:top="91" dlg:width="243" dlg:height="173" dlg:closeable="true" dlg:moveable="true">
 <dlg:styles>
  <dlg:style dlg:style-id="0" dlg:font-name="Sans" dlg:font-stylename="Bold" dlg:font-family="swiss" dlg:font-weight="150"/>
  <dlg:style dlg:style-id="1" dlg:border="simple"/>
 </dlg:styles>
 <dlg:bulletinboard>
  <dlg:text dlg:style-id="0" dlg:id="message" dlg:tab-index="0" dlg:left="5" dlg:top="13" dlg:width="233" dlg:height="20" dlg:help-url="vnd.sun.star.help://help/vnd.include-once.pagetranslate/errors.xhp?Language=en&amp;amp;System=UNIX&amp;amp;UseDB=no" dlg:value="msg/err"/>
  <dlg:button dlg:id="Close" dlg:tab-index="1" dlg:left="182" dlg:top="154" dlg:width="54" dlg:height="13" dlg:value="OK"/>
  <dlg:linklabel dlg:id="help" dlg:tab-index="2" dlg:left="4" dlg:top="149" dlg:width="65" dlg:height="17" dlg:help-url="vnd.sun.star.help://help/vnd.include-once.pagetranslate/errors.xhp?Language=en&amp;amp;System=UNIX&amp;amp;UseDB=no" dlg:value="see help section on common errors" dlg:multiline="true"/>
  <dlg:text dlg:id="Label1" dlg:tab-index="4" dlg:left="5" dlg:top="2" dlg:width="139" dlg:height="8" dlg:value="âš  So, we ran into a problem here:"/>
  <dlg:textfield dlg:style-id="1" dlg:id="exception" dlg:tab-index="3" dlg:left="5" dlg:top="36" dlg:width="233" dlg:height="108" dlg:hscroll="true" dlg:vscroll="true" dlg:multiline="true" dlg:value="exc/trc"/>

 </dlg:bulletinboard>
</dlg:window>










|


>


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="exceptions" dlg:left="135" dlg:top="91" dlg:width="243" dlg:height="173" dlg:closeable="true" dlg:moveable="true">
 <dlg:styles>
  <dlg:style dlg:style-id="0" dlg:font-name="Sans" dlg:font-stylename="Bold" dlg:font-family="swiss" dlg:font-weight="150"/>
  <dlg:style dlg:style-id="1" dlg:border="simple"/>
 </dlg:styles>
 <dlg:bulletinboard>
  <dlg:text dlg:style-id="0" dlg:id="message" dlg:tab-index="0" dlg:left="5" dlg:top="13" dlg:width="233" dlg:height="20" dlg:help-url="vnd.sun.star.help://help/vnd.include-once.pagetranslate/errors.xhp?Language=en&amp;amp;System=UNIX&amp;amp;UseDB=no" dlg:value="msg/err"/>
  <dlg:button dlg:id="Close" dlg:tab-index="1" dlg:left="182" dlg:top="154" dlg:width="54" dlg:height="13" dlg:value="OK"/>
  <dlg:linklabel dlg:id="help" dlg:tab-index="2" dlg:left="4" dlg:top="150" dlg:width="65" dlg:height="17" dlg:help-url="vnd.sun.star.help://help/vnd.include-once.pagetranslate/errors.xhp?Language=en&amp;amp;System=UNIX&amp;amp;UseDB=no" dlg:value="see help section on common errors" dlg:multiline="true"/>
  <dlg:text dlg:id="Label1" dlg:tab-index="4" dlg:left="5" dlg:top="2" dlg:width="139" dlg:height="8" dlg:value="âš  So, we ran into a problem here:"/>
  <dlg:textfield dlg:style-id="1" dlg:id="exception" dlg:tab-index="3" dlg:left="5" dlg:top="36" dlg:width="233" dlg:height="108" dlg:hscroll="true" dlg:vscroll="true" dlg:multiline="true" dlg:value="exc/trc"/>
  <dlg:linklabel dlg:id="bugreport" dlg:tab-index="6" dlg:left="85" dlg:top="150" dlg:width="30" dlg:height="17" dlg:help-url="https://fossil.include-once.org/pagetranslate/tktnew" dlg:value="or report as bug" dlg:url="https://fossil.include-once.org/pagetranslate/tktnew" dlg:multiline="true"/>
 </dlg:bulletinboard>
</dlg:window>

Changes to pythonpath/pt_dialogs.py.

65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
        self.message.MultiLine = True
        self.message.BackgroundColor = 0xFFDDCC
        self.message.FontDescriptor = FontDescriptor()
        self.message.FontDescriptor.Name = "Liberation Sans"
        self.message.FontDescriptor.StyleName = "Bold"
        self.message.FontDescriptor.Weight = 150.0
        #self.message.FontDescriptor.Family = "swiss"
        print(vars(self.message.FontDescriptor))

        # inserts the control model into the dialog model
        self.DialogModel.insertByName("message", self.message)

        # --------- create an instance of FixedText control, set properties ---
        self.Label1 = self.DialogModel.createInstance("com.sun.star.awt.UnoControlFixedTextModel")








|







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
        self.message.MultiLine = True
        self.message.BackgroundColor = 0xFFDDCC
        self.message.FontDescriptor = FontDescriptor()
        self.message.FontDescriptor.Name = "Liberation Sans"
        self.message.FontDescriptor.StyleName = "Bold"
        self.message.FontDescriptor.Weight = 150.0
        #self.message.FontDescriptor.Family = "swiss"
        #print(vars(self.message.FontDescriptor))

        # inserts the control model into the dialog model
        self.DialogModel.insertByName("message", self.message)

        # --------- create an instance of FixedText control, set properties ---
        self.Label1 = self.DialogModel.createInstance("com.sun.star.awt.UnoControlFixedTextModel")

108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124

















125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142

143
144
145
146
147
148
149

        # --------- create an instance of FixedHyperlink control, set properties ---
        self.help = self.DialogModel.createInstance("com.sun.star.awt.UnoControlFixedHyperlinkModel")

        self.help.Name = "help"
        self.help.TabIndex = 2
        self.help.PositionX = "4"
        self.help.PositionY = "149"
        self.help.Width = 65
        self.help.Height = 17
        self.help.HelpURL = "vnd.sun.star.help://help/vnd.include-once.pagetranslate/errors.xhp?Language=en&amp;System=UNIX&amp;UseDB=no"
        self.help.URL = "https://fossil.include-once.org/pagetranslate/file/help/en/vnd.include-once.pagetranslate/errors.duck"
        self.help.Label = "see help section on common errors"
        self.help.MultiLine = True

        # inserts the control model into the dialog model
        self.DialogModel.insertByName("help", self.help)


















        # --------- create an instance of Edit control, set properties ---
        self.exception = self.DialogModel.createInstance("com.sun.star.awt.UnoControlEditModel")

        self.exception.Name = "exception"
        self.exception.Border = 0
        self.exception.HScroll = True
        self.exception.VScroll = True
        self.exception.TabIndex = 3
        self.exception.PositionX = "5"
        self.exception.PositionY = "36"
        self.exception.Width = 233
        self.exception.Height = 108
        self.exception.Text = exc
        self.exception.MultiLine = True

        # inserts the control model into the dialog model
        self.DialogModel.insertByName("exception", self.exception)


    def showDialog(self):
        self.DialogContainer.setVisible(True)
        self.DialogContainer.createPeer(self.Toolkit, None)
        self.DialogContainer.execute()

    # --------- functions -----------------------







|









>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>













|
|



>







108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167

        # --------- create an instance of FixedHyperlink control, set properties ---
        self.help = self.DialogModel.createInstance("com.sun.star.awt.UnoControlFixedHyperlinkModel")

        self.help.Name = "help"
        self.help.TabIndex = 2
        self.help.PositionX = "4"
        self.help.PositionY = "150"
        self.help.Width = 65
        self.help.Height = 17
        self.help.HelpURL = "vnd.sun.star.help://help/vnd.include-once.pagetranslate/errors.xhp?Language=en&amp;System=UNIX&amp;UseDB=no"
        self.help.URL = "https://fossil.include-once.org/pagetranslate/file/help/en/vnd.include-once.pagetranslate/errors.duck"
        self.help.Label = "see help section on common errors"
        self.help.MultiLine = True

        # inserts the control model into the dialog model
        self.DialogModel.insertByName("help", self.help)

        # --------- create an instance of FixedHyperlink control, set properties ---
        self.bugreport = self.DialogModel.createInstance("com.sun.star.awt.UnoControlFixedHyperlinkModel")

        self.bugreport.Name = "bugreport"
        self.bugreport.TabIndex = 6
        self.bugreport.PositionX = "85"
        self.bugreport.PositionY = "150"
        self.bugreport.Width = 30
        self.bugreport.Height = 17
        self.bugreport.HelpURL = "https://fossil.include-once.org/pagetranslate/tktnew"
        self.bugreport.Label = "or report as bug"
        self.bugreport.URL = "https://fossil.include-once.org/pagetranslate/tktnew"
        self.bugreport.MultiLine = True

        # inserts the control model into the dialog model
        self.DialogModel.insertByName("bugreport", self.bugreport)

        # --------- create an instance of Edit control, set properties ---
        self.exception = self.DialogModel.createInstance("com.sun.star.awt.UnoControlEditModel")

        self.exception.Name = "exception"
        self.exception.Border = 0
        self.exception.HScroll = True
        self.exception.VScroll = True
        self.exception.TabIndex = 3
        self.exception.PositionX = "5"
        self.exception.PositionY = "36"
        self.exception.Width = 233
        self.exception.Height = 108
        self.exception.MultiLine = True
        self.exception.Text = exc

        # inserts the control model into the dialog model
        self.DialogModel.insertByName("exception", self.exception)


    def showDialog(self):
        self.DialogContainer.setVisible(True)
        self.DialogContainer.createPeer(self.Toolkit, None)
        self.DialogContainer.execute()

    # --------- functions -----------------------
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
def langselect(*args):

    try:
        ctx = remote_ctx                    # IDE
    except:
        ctx = uno.getComponentContext()     # UI

    # get desktop
    desktop = ctx.getByName("/singletons/com.sun.star.frame.theDesktop")

    # get document
    document = desktop.getCurrentComponent()

    app = LangApp(ctx=ctx)
    app.showDialog()
    return app.fr, app.to








<
<
<
<
<
<




343
344
345
346
347
348
349






350
351
352
353
def langselect(*args):

    try:
        ctx = remote_ctx                    # IDE
    except:
        ctx = uno.getComponentContext()     # UI







    app = LangApp(ctx=ctx)
    app.showDialog()
    return app.fr, app.to