Skip to content

Commit

Permalink
git subrepo pull uno
Browse files Browse the repository at this point in the history
subrepo:
  subdir:   "uno"
  merged:   "8c6c7a0f"
upstream:
  origin:   "https://github.com/prrvchr/uno.git"
  branch:   "main"
  commit:   "8c6c7a0f"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo.git"
  commit:   "2f68596"
  • Loading branch information
prrvchr committed Oct 7, 2024
1 parent 8932e5e commit 80b8d57
Show file tree
Hide file tree
Showing 18 changed files with 42 additions and 272 deletions.
4 changes: 2 additions & 2 deletions uno/.gitrepo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[subrepo]
remote = https://github.com/prrvchr/uno.git
branch = main
commit = 690924528f7680e6fcb0389e8c36184056fbed24
parent = 577a1fb492834a55fc9d9e9b3037ff51197d8961
commit = 8c6c7a0fe5739ccfff679cdd09cf8c35fb89423b
parent = 8932e5e2a667d6af00c5a8ab821e8c80d89f2963
method = merge
cmdver = 0.4.3
36 changes: 2 additions & 34 deletions uno/dialog/embedded/OptionsDialog.xdl
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,7 @@
<dlg:style dlg:style-id="0" dlg:font-weight="150"/>
</dlg:styles>
<dlg:bulletinboard>
<dlg:fixedline dlg:style-id="0" dlg:id="FixedLine1" dlg:tab-index="0" dlg:left="6" dlg:top="63" dlg:width="244" dlg:height="14" dlg:help-text="&amp;OptionsDialog.FixedLine1.HelpText" dlg:value="&amp;OptionsDialog.FixedLine1.Label"/>
<dlg:text dlg:id="Label1" dlg:tab-index="1" dlg:left="10" dlg:top="80" dlg:width="60" dlg:height="15" dlg:help-text="&amp;OptionsDialog.Label1.HelpText" dlg:value="&amp;OptionsDialog.Label1.Label" dlg:valign="center"/>
<dlg:text dlg:id="Label2" dlg:tab-index="2" dlg:left="140" dlg:top="80" dlg:width="110" dlg:height="15" dlg:help-text="&amp;OptionsDialog.Label2.HelpText" dlg:align="right" dlg:valign="center"/>
<dlg:text dlg:id="Label3" dlg:tab-index="3" dlg:left="10" dlg:top="100" dlg:width="35" dlg:height="15" dlg:help-text="&amp;OptionsDialog.Label3.HelpText" dlg:value="&amp;OptionsDialog.Label3.Label" dlg:valign="center"/>
<dlg:radiogroup>
<dlg:radio dlg:id="OptionButton1" dlg:tab-index="4" dlg:left="50" dlg:top="100" dlg:width="90" dlg:height="15" dlg:help-text="&amp;OptionsDialog.OptionButton1.HelpText" dlg:value="&amp;OptionsDialog.OptionButton1.Label" dlg:valign="center">
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:Base" script:language="UNO"/>
</dlg:radio>
<dlg:radio dlg:id="OptionButton2" dlg:tab-index="5" dlg:left="160" dlg:top="100" dlg:width="90" dlg:height="15" dlg:help-text="&amp;OptionsDialog.OptionButton2.HelpText" dlg:value="&amp;OptionsDialog.OptionButton2.Label" dlg:valign="center">
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:Enhanced" script:language="UNO"/>
</dlg:radio>
</dlg:radiogroup>
<dlg:text dlg:id="Label4" dlg:tab-index="6" dlg:left="10" dlg:top="120" dlg:width="35" dlg:height="15" dlg:help-text="&amp;OptionsDialog.Label4.HelpText" dlg:value="&amp;OptionsDialog.Label4.Label" dlg:valign="center"/>
<dlg:radiogroup>
<dlg:radio dlg:id="OptionButton3" dlg:tab-index="7" dlg:left="50" dlg:top="120" dlg:width="65" dlg:height="15" dlg:help-text="&amp;OptionsDialog.OptionButton3.HelpText" dlg:value="&amp;OptionsDialog.OptionButton3.Label" dlg:valign="center">
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:Level0" script:language="UNO"/>
</dlg:radio>
<dlg:radio dlg:id="OptionButton4" dlg:tab-index="8" dlg:left="120" dlg:top="120" dlg:width="65" dlg:height="15" dlg:help-text="&amp;OptionsDialog.OptionButton4.HelpText" dlg:value="&amp;OptionsDialog.OptionButton4.Label" dlg:valign="center">
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:Level1" script:language="UNO"/>
</dlg:radio>
<dlg:radio dlg:id="OptionButton5" dlg:tab-index="9" dlg:left="190" dlg:top="120" dlg:width="65" dlg:height="15" dlg:help-text="&amp;OptionsDialog.OptionButton5.HelpText" dlg:value="&amp;OptionsDialog.OptionButton5.Label" dlg:valign="center">
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:Level2" script:language="UNO"/>
</dlg:radio>
</dlg:radiogroup>
<dlg:checkbox dlg:id="CheckBox1" dlg:tab-index="10" dlg:left="10" dlg:top="140" dlg:width="80" dlg:height="15" dlg:help-text="&amp;OptionsDialog.CheckBox1.HelpText" dlg:value="&amp;OptionsDialog.CheckBox1.Label" dlg:valign="center" dlg:checked="false">
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:SystemTable" script:language="UNO"/>
</dlg:checkbox>
<dlg:checkbox dlg:id="CheckBox2" dlg:tab-index="11" dlg:left="95" dlg:top="140" dlg:width="80" dlg:height="15" dlg:help-text="&amp;OptionsDialog.CheckBox2.HelpText" dlg:value="&amp;OptionsDialog.CheckBox2.Label" dlg:valign="center" dlg:checked="true">
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:UseBookmark" script:language="UNO"/>
</dlg:checkbox>
<dlg:checkbox dlg:id="CheckBox3" dlg:tab-index="12" dlg:left="180" dlg:top="140" dlg:width="75" dlg:height="15" dlg:help-text="&amp;OptionsDialog.CheckBox3.HelpText" dlg:value="&amp;OptionsDialog.CheckBox3.Label" dlg:valign="center" dlg:checked="false">
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:SQLMode" script:language="UNO"/>
</dlg:checkbox>
<dlg:text dlg:style-id="0" dlg:id="Label5" dlg:tab-index="13" dlg:left="10" dlg:top="165" dlg:width="240" dlg:height="15" dlg:help-text="&amp;OptionsDialog.Label5.HelpText" dlg:value="&amp;OptionsDialog.Label5.Label" dlg:align="center" dlg:valign="center"/>
<dlg:text dlg:style-id="0" dlg:id="Label1" dlg:left="6" dlg:top="160" dlg:width="60" dlg:height="15" dlg:help-text="&amp;OptionsDialog.Label1.HelpText" dlg:value="&amp;OptionsDialog.Label1.Label" dlg:valign="center"/>
<dlg:text dlg:id="Label2" dlg:left="140" dlg:top="160" dlg:width="110" dlg:height="15" dlg:help-text="&amp;OptionsDialog.Label2.HelpText" dlg:value="&amp;OptionsDialog.Label2.Label" dlg:align="right" dlg:valign="center"/>
</dlg:bulletinboard>
</dlg:window>
27 changes: 2 additions & 25 deletions uno/dialog/embedded/OptionsDialog_en_US.properties
Original file line number Diff line number Diff line change
@@ -1,29 +1,6 @@
OptionsDialog.HelpText=
OptionsDialog.Title=
OptionsDialog.FixedLine1.HelpText=
OptionsDialog.FixedLine1.Label=UNO Services
OptionsDialog.Label1.HelpText=
OptionsDialog.Label1.Label=Driver version:
OptionsDialog.Label1.Label=Driver version
OptionsDialog.Label2.HelpText=
OptionsDialog.Label3.HelpText=
OptionsDialog.Label3.Label=Driver:
OptionsDialog.OptionButton1.HelpText=
OptionsDialog.OptionButton1.Label=com.sun.star.sdbc.Driver
OptionsDialog.OptionButton2.HelpText=
OptionsDialog.OptionButton2.Label=com.sun.star.sdbcx.Driver
OptionsDialog.Label4.HelpText=
OptionsDialog.Label4.Label=Connection:
OptionsDialog.OptionButton3.HelpText=
OptionsDialog.OptionButton3.Label=sdbc.Connection
OptionsDialog.OptionButton4.HelpText=
OptionsDialog.OptionButton4.Label=sdbcx.Connection
OptionsDialog.OptionButton5.HelpText=
OptionsDialog.OptionButton5.Label=sdb.Connection
OptionsDialog.CheckBox1.HelpText=
OptionsDialog.CheckBox1.Label=View system tables
OptionsDialog.CheckBox2.HelpText=
OptionsDialog.CheckBox2.Label=Use bookmarks
OptionsDialog.CheckBox3.HelpText=
OptionsDialog.CheckBox3.Label=Force SQL mode
OptionsDialog.Label5.HelpText=
OptionsDialog.Label5.Label=The changes will take effect after restarting LibreOffice...
OptionsDialog.Label2.Label=
27 changes: 2 additions & 25 deletions uno/dialog/embedded/OptionsDialog_fr_FR.properties
Original file line number Diff line number Diff line change
@@ -1,29 +1,6 @@
OptionsDialog.HelpText=
OptionsDialog.Title=
OptionsDialog.FixedLine1.HelpText=
OptionsDialog.FixedLine1.Label=Services UNO
OptionsDialog.Label1.HelpText=
OptionsDialog.Label1.Label=Version du pilote:
OptionsDialog.Label1.Label=Version du pilote
OptionsDialog.Label2.HelpText=
OptionsDialog.Label3.HelpText=
OptionsDialog.Label3.Label=Pilote:
OptionsDialog.OptionButton1.HelpText=
OptionsDialog.OptionButton1.Label=com.sun.star.sdbc.Driver
OptionsDialog.OptionButton2.HelpText=
OptionsDialog.OptionButton2.Label=com.sun.star.sdbcx.Driver
OptionsDialog.Label4.HelpText=
OptionsDialog.Label4.Label=Connexion:
OptionsDialog.OptionButton3.HelpText=
OptionsDialog.OptionButton3.Label=sdbc.Connection
OptionsDialog.OptionButton4.HelpText=
OptionsDialog.OptionButton4.Label=sdbcx.Connection
OptionsDialog.OptionButton5.HelpText=
OptionsDialog.OptionButton5.Label=sdb.Connection
OptionsDialog.CheckBox1.HelpText=
OptionsDialog.CheckBox1.Label=Voir les tables syst\u00e8me
OptionsDialog.CheckBox2.HelpText=
OptionsDialog.CheckBox2.Label=Utiliser les signets
OptionsDialog.CheckBox3.HelpText=
OptionsDialog.CheckBox3.Label=Forcer le mode SQL
OptionsDialog.Label5.HelpText=
OptionsDialog.Label5.Label=Les modifications prendront effet apr\u00e8s le red\u00e9marrage de LibreOffice...
OptionsDialog.Label2.Label=
1 change: 1 addition & 0 deletions uno/dialog/embedded/UnoDriverDialog.xdl
1 change: 1 addition & 0 deletions uno/dialog/embedded/UnoDriverDialog_en_US.default
1 change: 1 addition & 0 deletions uno/dialog/embedded/UnoDriverDialog_en_US.properties
1 change: 1 addition & 0 deletions uno/dialog/embedded/UnoDriverDialog_fr_FR.properties
4 changes: 2 additions & 2 deletions uno/lib/uno/embedded/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,12 @@ def _checkLibreOffice(self):
def _getConnectionInfo(self, infos):
document = storage = url = None
config = getConfiguration(self._ctx, g_identifier)
service = config.getByName('ConnectionService')
level = config.getByName('ApiLevel')
system = config.getByName('ShowSystemTable')
bookmark = config.getByName('UseBookmark')
mode = config.getByName('SQLMode')
newinfos = {'Url': g_url,
'ConnectionService': service,
'ApiLevel': level,
'ShowSystemTable': system,
'UseBookmark': bookmark,
'SQLMode': mode}
Expand Down
3 changes: 1 addition & 2 deletions uno/lib/uno/embedded/options/optionshandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,5 @@ def disposing(self, source):
try:
self._manager.dispose()
except Exception as e:
msg = "OptionsHandler.disposing() Error: %s" % traceback.format_exc()
print(msg)
print("ERROR: %s - %s" % (e, traceback.format_exc()))

69 changes: 13 additions & 56 deletions uno/lib/uno/embedded/options/optionsmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,82 +27,39 @@
╚════════════════════════════════════════════════════════════════════════════════════╝
"""

from com.sun.star.ui.dialogs.ExecutableDialogResults import OK

from com.sun.star.logging.LogLevel import INFO
from com.sun.star.logging.LogLevel import SEVERE

from .optionsmodel import OptionsModel
from .optionsview import OptionsView
from .optionshandler import OptionsListener

from ..logger import LogManager
from ..jdbc import JdbcManager

from ..configuration import g_defaultlog

import os
import sys
import traceback


class OptionsManager():
def __init__(self, ctx, window, url=None):
self._ctx = ctx
self._disposed = False
self._disabled = False
self._model = OptionsModel(ctx, url)
window.addEventListener(OptionsListener(self))
self._view = OptionsView(window, OptionsManager._restart)
self._view.initView(*self._model.getViewData())
self._logmanager = LogManager(ctx, window.getPeer(), 'requirements.txt', g_defaultlog)

_restart = False
self._view = OptionsView(window)
self._jdbcmanager = JdbcManager(ctx, window, g_defaultlog)
version = self._model.getDriverVersion(self._service())
self._view.setDriverVersion(version)

def dispose(self):
self._logmanager.dispose()
self._disposed = True

# TODO: One shot disabler handler
def isHandlerEnabled(self):
if self._disabled:
self._disabled = False
return False
return True
self._jdbcmanager.dispose()

# OptionsManager setter methods
def updateView(self, versions):
with self._lock:
self.updateVersion(versions)

def updateVersion(self, versions):
with self._lock:
if not self._disposed:
protocol = self._view.getSelectedProtocol()
if protocol in versions:
self._view.setVersion(versions[protocol])

def saveSetting(self):
if self._logmanager.saveSetting() or self._model.saveSetting():
OptionsManager._restart = True
self._view.setRestart(True)
self._jdbcmanager.saveSetting()

def loadSetting(self):
self._logmanager.loadSetting()
self._view.initView(*self._model.loadSetting())

def setDriverService(self, driver):
self._view.setConnectionLevel(*self._model.setDriverService(driver))

def setConnectionService(self, level):
self._model.setConnectionService(level)

def setSystemTable(self, state):
self._model.setSystemTable(state)

def setBookmark(self, state):
self._model.setBookmark(state)
self._view.enableSQLMode(state)
self._jdbcmanager.loadSetting()
version = self._model.getDriverVersion(self._service())
self._view.setDriverVersion(version)

def setSQLMode(self, state):
self._model.setSQLMode(state)
# OptionsManager private methods
def _service(self):
return self._jdbcmanager.getDriverService()

74 changes: 2 additions & 72 deletions uno/lib/uno/embedded/options/optionsmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
from com.sun.star.uno import Exception as UnoException

from ..unotool import createService
from ..unotool import getConfiguration

from ..configuration import g_identifier
from ..configuration import g_defaultlog

from ..logger import getLogger
Expand All @@ -48,82 +46,13 @@ class OptionsModel():
def __init__(self, ctx, url=None):
self._ctx = ctx
self._url = url
self._services = {'Driver': ('io.github.prrvchr.jdbcdriver.sdbc.Driver',
'io.github.prrvchr.jdbcdriver.sdbcx.Driver'),
'Connection': ('com.sun.star.sdbc.Connection',
'com.sun.star.sdbcx.Connection',
'com.sun.star.sdb.Connection')}
self._config = getConfiguration(ctx, g_identifier, True)
self._service = self._getDriverService()

# OptionsModel getter methods
def getViewData(self):
driver = self._services.get('Driver').index(self._getDriverService())
connection = self._services.get('Connection').index(self._getConnectionService())
enabled = self._isConnectionEnabled(driver)
version = self._getDriverVersion()
system = self._config.getByName('ShowSystemTable')
bookmark = self._config.getByName('UseBookmark')
mode = self._config.getByName('SQLMode')
return driver, connection, enabled, version, system, bookmark, mode

def loadSetting(self):
self._config = getConfiguration(self._ctx, g_identifier, True)
return self.getViewData()

def getServicesLevel(self):
driver = self._services.get('Driver').index(self._getDriverService())
connection = self._services.get('Connection').index(self._getConnectionService())
return driver, connection, self._isConnectionEnabled(driver)

# OptionsModel setter methods
def setDriverService(self, driver):
self._config.replaceByName('DriverService', self._services.get('Driver')[driver])
connection = self._services.get('Connection').index(self._getConnectionService())
if driver and not connection:
connection = 1
self.setConnectionService(connection)
return connection, self._isConnectionEnabled(driver)

def setConnectionService(self, level):
self._config.replaceByName('ConnectionService', self._services.get('Connection')[level])

def setSystemTable(self, state):
self._config.replaceByName('ShowSystemTable', bool(state))

def setBookmark(self, state):
self._config.replaceByName('UseBookmark', bool(state))

def setSQLMode(self, state):
self._config.replaceByName('SQLMode', bool(state))

def saveSetting(self):
config = self._config.hasPendingChanges()
if config:
self._config.commitChanges()
if self._service != self._getDriverService():
return True
return False

# OptionsModel private methods
def _getDriverService(self):
return self._config.getByName('DriverService')

def _getConnectionService(self):
return self._config.getByName('ConnectionService')

def _isConnectionEnabled(self, driver):
return driver == 0

def _getLevelValue(self, level):
return '%d' % level

def _getDriverVersion(self):
def getDriverVersion(self, service):
version = 'N/A'
if self._url is None:
return version
try:
service = self._getDriverService()
driver = createService(self._ctx, service)
# FIXME: If jdbcDriverOOo extension has not been installed then driver is None
if driver is not None:
Expand All @@ -137,5 +66,6 @@ def _getDriverVersion(self):
self._getLogger().logprb(SEVERE, 'OptionsModel', '_getDriverVersion()', 142, str(e), traceback.format_exc())
return version

# OptionsModel private methods
def _getLogger(self):
return getLogger(self._ctx, g_defaultlog, g_basename)
Loading

0 comments on commit 80b8d57

Please sign in to comment.