From 523b7ad575ac01df6b72a8e3e883ebd6da317aeb Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Thu, 27 Jan 2022 10:32:49 -0700 Subject: adjust settings paths for Haiku diff --git a/cola/gitcfg.py b/cola/gitcfg.py index af12a70..d317fca 100644 --- a/cola/gitcfg.py +++ b/cola/gitcfg.py @@ -21,6 +21,7 @@ _USER_CONFIG = core.expanduser(join('~', '.gitconfig')) _USER_XDG_CONFIG = core.expanduser( join(core.getenv('XDG_CONFIG_HOME', join('~', '.config')), 'git', 'config') ) +_USER_HAIKU_CONFIG = '/boot/home/config/settings/git/config' def create(context): @@ -34,6 +35,7 @@ def _stat_info(git): ('system', '/etc/gitconfig'), ('user', _USER_XDG_CONFIG), ('user', _USER_CONFIG), + ('user', _USER_HAIKU_CONFIG), ] config = git.git_path('config') if config: @@ -54,6 +56,7 @@ def _cache_key(git): '/etc/gitconfig', _USER_XDG_CONFIG, _USER_CONFIG, + _USER_HAIKU_CONFIG, ] config = git.git_path('config') if config: diff --git a/cola/resources.py b/cola/resources.py index e8a74f1..ac3faa2 100644 --- a/cola/resources.py +++ b/cola/resources.py @@ -15,6 +15,7 @@ _modpath = core.abspath(core.realpath(__file__)) if ( os.path.join('share', 'git-cola', 'lib') in _modpath or os.path.join('site-packages', 'cola') in _modpath + or utils.is_haiku() ): # this is the release tree # __file__ = '$prefix/share/git-cola/lib/cola/__file__.py' @@ -111,7 +112,10 @@ def icon_dir(theme): def config_home(*args): - config = core.getenv( - 'XDG_CONFIG_HOME', os.path.join(core.expanduser('~'), '.config') - ) + if utils.is_haiku(): + config = '/boot/home/config/settings' + else: + config = core.getenv( + 'XDG_CONFIG_HOME', os.path.join(core.expanduser('~'), '.config') + ) return os.path.join(config, 'git-cola', *args) diff --git a/cola/utils.py b/cola/utils.py index 1c97084..8144757 100644 --- a/cola/utils.py +++ b/cola/utils.py @@ -312,6 +312,11 @@ def is_win32(): return sys.platform == 'win32' or sys.platform == 'cygwin' +def is_haiku(): + """Return True on Haiku""" + return sys.platform.startswith('haiku') + + def expandpath(path): """Expand ~user/ and environment $variables""" path = os.path.expandvars(path) -- 2.30.2 From 92791f2cf1d210a6f0641e8fbd6ede4a0f2acd9f Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Thu, 27 Jan 2022 10:33:47 -0700 Subject: adjust Terminal and open commands on Haiku diff --git a/cola/cmds.py b/cola/cmds.py index 68a38d3..6a06ae1 100644 --- a/cola/cmds.py +++ b/cola/cmds.py @@ -1670,7 +1670,7 @@ class OpenDefaultApp(ContextCommand): def __init__(self, context, filenames): super(OpenDefaultApp, self).__init__(context) - if utils.is_darwin(): + if utils.is_darwin() or utils.is_haiku(): launcher = 'open' else: launcher = 'xdg-open' diff --git a/cola/gitcfg.py b/cola/gitcfg.py index d317fca..566358e 100644 --- a/cola/gitcfg.py +++ b/cola/gitcfg.py @@ -473,6 +473,8 @@ class GitConfig(observable.Observable): if os.path.isfile(candidate): return candidate return None + elif utils.is_haiku(): + return 'Terminal -w' else: candidates = ('xfce4-terminal', 'konsole', 'gnome-terminal') for basename in candidates: -- 2.30.2 From 2e2b0b6f4b42bb8dde1c5c2faf0ecf3fef79db2d Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Thu, 27 Jan 2022 10:35:20 -0700 Subject: path adjustments for building as a Haiku package diff --git a/bin/git-cola b/bin/git-cola index 15098fe..100cea9 100755 --- a/bin/git-cola +++ b/bin/git-cola @@ -26,6 +26,7 @@ def setup_environment(): prefix = os.path.dirname(os.path.dirname(os.path.realpath(abspath))) install_lib = os.path.join(prefix, str('share'), str('git-cola'), str('lib')) win_pkgs = os.path.join(prefix, str('pkgs')) + haiku_pkg = os.path.join(prefix, str('data'), str('git-cola'), str('lib')) # Use the private modules from share/git-cola/lib when they exist. # It is assumed that that our modules to be present in sys.path through python's # site-packages directory when the private modules do not exist. @@ -33,6 +34,8 @@ def setup_environment(): sys.path.insert(1, install_lib) elif os.path.exists(win_pkgs): sys.path.insert(1, win_pkgs) + elif os.path.exists(haiku_pkg): + sys.path.insert(1, haiku_pkg) if __name__ == '__main__': diff --git a/bin/git-cola-sequence-editor b/bin/git-cola-sequence-editor index c4155da..fb6b5db 100755 --- a/bin/git-cola-sequence-editor +++ b/bin/git-cola-sequence-editor @@ -26,6 +26,7 @@ def setup_environment(): prefix = os.path.dirname(os.path.dirname(os.path.realpath(abspath))) install_lib = os.path.join(prefix, str('share'), str('git-cola'), str('lib')) win_pkgs = os.path.join(prefix, str('pkgs')) + haiku_pkg = os.path.join(prefix, str('data'), str('git-cola'), str('lib')) # Use the private modules from share/git-cola/lib when they exist. # It is assumed that that our modules to be present in sys.path through python's # site-packages directory when the private modules do not exist. @@ -33,6 +34,8 @@ def setup_environment(): sys.path.insert(1, install_lib) elif os.path.exists(win_pkgs): sys.path.insert(1, win_pkgs) + elif os.path.exists(haiku_pkg): + sys.path.insert(1, haiku_pkg) if __name__ == '__main__': diff --git a/bin/git-dag b/bin/git-dag index c96880e..3ef54e1 100755 --- a/bin/git-dag +++ b/bin/git-dag @@ -26,6 +26,7 @@ def setup_environment(): prefix = os.path.dirname(os.path.dirname(os.path.realpath(abspath))) install_lib = os.path.join(prefix, str('share'), str('git-cola'), str('lib')) win_pkgs = os.path.join(prefix, str('pkgs')) + haiku_pkg = os.path.join(prefix, str('data'), str('git-cola'), str('lib')) # Use the private modules from share/git-cola/lib when they exist. # It is assumed that that our modules to be present in sys.path through python's # site-packages directory when the private modules do not exist. @@ -33,6 +34,8 @@ def setup_environment(): sys.path.insert(1, install_lib) elif os.path.exists(win_pkgs): sys.path.insert(1, win_pkgs) + elif os.path.exists(haiku_pkg): + sys.path.insert(1, haiku_pkg) if __name__ == '__main__': diff --git a/cola/resources.py b/cola/resources.py index ac3faa2..68f0fa7 100644 --- a/cola/resources.py +++ b/cola/resources.py @@ -6,6 +6,7 @@ import webbrowser from . import core from . import compat +from . import utils # Default git-cola icon theme @@ -58,7 +59,10 @@ def command(name): def doc(*args): """Return a path relative to cola's /usr/share/doc/ directory""" - return os.path.join(_prefix, 'share', 'doc', 'git-cola', *args) + if utils.is_haiku(): + return os.path.join(_prefix, 'documentation', 'packages', 'git_cola', *args) + else: + return os.path.join(_prefix, 'share', 'doc', 'git-cola', *args) def html_docs(): @@ -80,7 +84,10 @@ def show_html_docs(): def share(*args): """Return a path relative to cola's /usr/share/ directory""" - return prefix('share', 'git-cola', *args) + if utils.is_haiku(): + return prefix('data', 'git-cola', *args) + else: + return prefix('share', 'git-cola', *args) def icon_dir(theme): diff --git a/setup.py b/setup.py index b8d8c39..e218f37 100755 --- a/setup.py +++ b/setup.py @@ -135,7 +135,10 @@ def _package(package, subdirs=None): def _lib_path(*dirs): - return os.path.join('share', 'git-cola', 'lib', *dirs) + if sys.platform.startswith('haiku'): + return os.path.join('data', 'git-cola', 'lib', *dirs) + else: + return os.path.join('share', 'git-cola', 'lib', *dirs) def _app_path(dirname, entry): -- 2.30.2 From e187bd2386755b710aa71a916c471f75e5d63083 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Thu, 27 Jan 2022 10:35:51 -0700 Subject: fullscreen windows are annoying diff --git a/cola/widgets/main.py b/cola/widgets/main.py index a3b1dc8..109e4eb 100644 --- a/cola/widgets/main.py +++ b/cola/widgets/main.py @@ -873,7 +873,7 @@ class MainView(standard.MainWindow): def set_initial_size(self): # Default size; this is thrown out when save/restore is used width, height = qtutils.desktop_size() - self.resize((width * 3) // 4, height) + self.resize((width * 3) // 4, (height * 3) // 4) self.statuswidget.set_initial_size() self.commiteditor.set_initial_size() diff --git a/cola/widgets/standard.py b/cola/widgets/standard.py index d15ca23..0667627 100644 --- a/cola/widgets/standard.py +++ b/cola/widgets/standard.py @@ -46,6 +46,8 @@ class WidgetMixin(object): height = desktop.height() if utils.is_darwin(): self.resize(width, height) + elif utils.is_haiku(): + self.resize((width * 3) // 4, (height * 3) // 4) else: shown = self.isVisible() # earlier show() fools Windows focus stealing prevention. the main -- 2.30.2