Grammalecte  Check-in [f015dc603b]

Overview
Comment:[lo] options dialog: tabs (draft)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | lo
Files: files | file ages | folders
SHA3-256: f015dc603b562ff1a6dc8ce22efd2d48b1747a6be44bb9cda3c9b0d737978ec5
User & Date: olr on 2019-07-17 10:19:51
Other Links: manifest | tags
Context
2019-07-17
10:25
[fr] phonet_simil: scan / scanne check-in: b49a83c9df user: olr tags: trunk, fr
10:19
[lo] options dialog: tabs (draft) check-in: f015dc603b user: olr tags: trunk, lo
10:19
[lo] helpers: get product name and version check-in: f249f05cff user: olr tags: trunk, lo
Changes

Modified gc_core/py/oxt/Options.py from [baf12f1015] to [1edac42d1a].

51
52
53
54
55
56
57



58
59
60
61
62
63
64
65

    def __init__ (self, ctx):
        self.ctx = ctx
        self.xSvMgr = self.ctx.ServiceManager
        self.xContainer = None

    def _addWidget (self, name, wtype, x, y, w, h, **kwargs):



        xWidget = self.xDialog.createInstance('com.sun.star.awt.UnoControl%sModel' % wtype)
        xWidget.Name = name
        xWidget.PositionX = x
        xWidget.PositionY = y
        xWidget.Width = w
        xWidget.Height = h
        for k, w in kwargs.items():
            setattr(xWidget, k, w)







>
>
>
|







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68

    def __init__ (self, ctx):
        self.ctx = ctx
        self.xSvMgr = self.ctx.ServiceManager
        self.xContainer = None

    def _addWidget (self, name, wtype, x, y, w, h, **kwargs):
        if wtype.startswith("com."):
            xWidget = self.xDialog.createInstance(wtype)
        else:
            xWidget = self.xDialog.createInstance('com.sun.star.awt.UnoControl%sModel' % wtype)
        xWidget.Name = name
        xWidget.PositionX = x
        xWidget.PositionY = y
        xWidget.Width = w
        xWidget.Height = h
        for k, w in kwargs.items():
            setattr(xWidget, k, w)
91
92
93
94
95
96
97



98
99
100
101
102
103
104
105
106
107

108
109
110
111
112









113
114
115
116
117
118
119
120
            # build
            y = 0
            nWidth = self.xDialog.Width - 20
            nHeight = 10

            self.lOptionWidgets = []




            for t in gce.gc_options.lStructOpt:
                x = 10
                y += 10
                self._addWidget(t[0], 'FixedLine', x, y, nWidth, nHeight, Label = dOptionUI.get(t[0], "#err")[0], FontDescriptor= xFDTitle)
                y += 3
                for lOptLine in t[1]:
                    x = 15
                    y += 10
                    n = len(lOptLine)
                    for sOpt in lOptLine:

                        w = self._addWidget(sOpt, 'CheckBox', x, y, nWidth/n, nHeight, \
                                            Label = dOptionUI.get(sOpt, "#err")[0], HelpText = dOptionUI.get(sOpt, "#err")[1])
                        self.lOptionWidgets.append(w)
                        x += nWidth / n










            self.xDialog.Height = y + 40

            xWindowSize = helpers.getWindowSize()
            self.xDialog.PositionX = int((xWindowSize.Width / 2) - (self.xDialog.Width / 2))
            self.xDialog.PositionY = int((xWindowSize.Height / 2) - (self.xDialog.Height / 2))

            self._addWidget('default', 'Button', 10, self.xDialog.Height-20, 50, 14, \
                            Label = dUI.get('default', "#err"), FontDescriptor = xFDBut, TextColor = 0x000044)







>
>
>
|
|
|
|
|
|
|
|
|
|
>
|
<
|
|
|
>
>
>
>
>
>
>
>
>
|







94
95
96
97
98
99
100
101
102
103
104
105
106
107
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
            # build
            y = 0
            nWidth = self.xDialog.Width - 20
            nHeight = 10

            self.lOptionWidgets = []

            sProdName, sVersion = helpers.getProductNameAndVersion()
            if True:
                # no tab available (bug)
                for sOptionType, lOptions in gce.gc_options.lStructOpt:
                    x = 10
                    y += 10
                    self._addWidget(sOptionType, 'FixedLine', x, y, nWidth, nHeight, Label = dOptionUI.get(sOptionType, "#err")[0], FontDescriptor= xFDTitle)
                    y += 3
                    for lOptLine in lOptions:
                        x = 15
                        y += 10
                        n = len(lOptLine)
                        for sOpt in lOptLine:
                            sLabel, sHelpText = dOptionUI.get(sOpt, "#err")
                            xOpt = self._addWidget(sOpt, 'CheckBox', x, y, nWidth/n, nHeight, Label = sLabel, HelpText = sHelpText)

                            self.lOptionWidgets.append(xOpt)
                            x += nWidth / n
                self.xDialog.Height = y + 40
            else:
                # we can use tabs
                xTabPageContainer = self._addWidget("tabs", "com.sun.star.awt.tab.UnoControlTabPageContainerModel", 10, 10, nWidth, 100)
                xTabPage1 = xTabPageContainer.createTabPage(0);
                xTabPage1.Title = "Page 1"
                xTabPage2 = xTabPageContainer.createTabPage(1);
                xTabPage2.Title = "Page 2"
                xTabPageContainer.insertByIndex(0, xTabPage1);
                xTabPageContainer.insertByIndex(1, xTabPage2);
                self.xDialog.Height = 300

            xWindowSize = helpers.getWindowSize()
            self.xDialog.PositionX = int((xWindowSize.Width / 2) - (self.xDialog.Width / 2))
            self.xDialog.PositionY = int((xWindowSize.Height / 2) - (self.xDialog.Height / 2))

            self._addWidget('default', 'Button', 10, self.xDialog.Height-20, 50, 14, \
                            Label = dUI.get('default', "#err"), FontDescriptor = xFDBut, TextColor = 0x000044)