Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

Преглед изворни кода

Merge pull request #166 from datalad/desktopfile

Add a desktopfile and a way to install it
Michael Hanke пре 2 година
родитељ
комит
d36d0cc7b3

+ 15 - 2
datalad_gooey/gooey.py

@@ -10,6 +10,8 @@ from datalad.interface.utils import eval_results
 
 from datalad.interface.results import get_status_dict
 
+from .postinstall import perform_post_install_tasks
+
 import logging
 lgr = logging.getLogger('datalad.ext.gooey.gooey')
 
@@ -48,7 +50,13 @@ class Gooey(Interface):
             # documentation
             doc="""The root location from which the Gooey file explorer will be
             launched (default is current working directory)""",
-        )
+        ),
+        postinstall=Parameter(
+            args=("--postinstall",),
+            doc="Perform post-installation tasks",
+            action="store_true",
+            # default=False,
+        ),
     )
 
     @staticmethod
@@ -58,11 +66,16 @@ class Gooey(Interface):
     @eval_results
     # signature must match parameter list above
     # additional generic arguments are added by decorators
-    def __call__(path: str = None):
+    def __call__(path: str = None, postinstall: bool = False):
         # local import to keep entrypoint import independent of PySide
         # availability
         from .app import GooeyApp, QApplication
 
+        # if requested, perform post-install tasks and exit
+        if postinstall:
+            perform_post_install_tasks()
+            return
+
         qtapp = QApplication(sys.argv)
         gooey = GooeyApp(path)
         gooey.main_window.show()

+ 38 - 0
datalad_gooey/postinstall.py

@@ -0,0 +1,38 @@
+from sys import platform
+
+from importlib_resources import files  # from Python 3.10 use importlib.resources
+from platformdirs import user_data_path
+
+
+def perform_post_install_tasks():
+    if platform == "linux":
+        create_desktop_file()
+        copy_icon()
+    else:
+        print("Nothing to do")
+
+
+def create_desktop_file():
+    df_name = "datalad-gooey.desktop"
+    template_path = files("datalad_gooey.resources.desktop").joinpath(df_name)
+    target_path = user_data_path() / "applications" / df_name
+
+    if not target_path.parent.exists():
+        target_path.parent.mkdir()
+
+    target_path.write_text(template_path.read_text())
+    print("Created desktop file in", target_path)
+
+
+def copy_icon():
+    source_path = files(
+        "datalad_gooey.resources.icons"
+    ).joinpath('datalad_gooey_logo.svg')
+    target_path = user_data_path() / "icons" / "datalad-gooey"
+
+    if not target_path.parent.exists():
+        target_path.parent.mkdir()
+
+    # svg is text & rewriting file contents is ok, no need for shutil.copy
+    target_path.write_text(source_path.read_text())
+    print("Created icon in", target_path)

+ 11 - 0
datalad_gooey/resources/desktop/datalad-gooey.desktop

@@ -0,0 +1,11 @@
+[Desktop Entry]
+Type=Application
+Name=DataLad Gooey
+GenericName=Data management system
+Comment=Manage and work with DataLad datasets
+Comment[de]=Nutzen und verwalten von DataLad Datasets
+Exec=datalad gooey %f
+Terminal=false
+Icon=datalad-gooey
+Categories=Network;Development;Science
+Keywords=rdm;git-annex;git

+ 143 - 0
datalad_gooey/resources/icons/datalad_gooey_logo.svg

@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   width="23.01165mm"
+   height="20.230003mm"
+   viewBox="0 0 23.01165 20.230003"
+   version="1.1"
+   id="svg977"
+   inkscape:export-filename="/tmp/gooey.png"
+   inkscape:export-xdpi="272.608"
+   inkscape:export-ydpi="272.608"
+   inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
+   sodipodi:docname="datalad_gooey_logo.svg"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:svg="http://www.w3.org/2000/svg">
+  <sodipodi:namedview
+     id="namedview979"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageshadow="2"
+     inkscape:pageopacity="0.0"
+     inkscape:pagecheckerboard="0"
+     inkscape:document-units="mm"
+     showgrid="false"
+     fit-margin-top="0"
+     fit-margin-left="0"
+     fit-margin-right="0"
+     fit-margin-bottom="0"
+     inkscape:zoom="7.5859286"
+     inkscape:cx="67.559297"
+     inkscape:cy="24.387258"
+     inkscape:window-width="2560"
+     inkscape:window-height="1371"
+     inkscape:window-x="0"
+     inkscape:window-y="1472"
+     inkscape:window-maximized="1"
+     inkscape:current-layer="layer1" />
+  <defs
+     id="defs974" />
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(-71.522487,-75.819375)">
+    <g
+       id="g1094"
+       transform="translate(22.38109,-8.2436513)" />
+    <g
+       id="g1263"
+       style="fill:#ffffff">
+      <g
+         id="g1134"
+         style="fill:#ffffff">
+        <path
+           style="fill:#ffffff;fill-opacity:1;stroke-width:0.313676;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:100000"
+           d="m 82.895231,76.400396 -2.74069,1.275443 c -1.50738,0.701487 -2.99497,1.391917 -3.30576,1.534297 -2.29151,1.04979 -3.27503,1.5282 -3.33455,1.62201 -0.0494,0.0778 -0.0498,0.13923 -10e-4,0.21542 0.0543,0.0856 9.04875,4.31884 9.40857,4.42819 h 2.5e-4 c 0.0548,0.0167 0.28395,0.0202 0.5092,0.008 0.3873,-0.0212 0.66067,-0.13937 5.03617,-2.17703 2.5446,-1.18502 4.65664,-2.20204 4.69346,-2.2601 0.0475,-0.0749 0.0469,-0.13716 -0.001,-0.21432 -0.0595,-0.0939 -1.04305,-0.57221 -3.33456,-1.62201 -0.31077,-0.14237 -1.79838,-0.83281 -3.30577,-1.534297 l -2.74068,-1.275442 h -0.44172 z m 7.35061,5.94402 -3.20288,1.49442 -3.2029,1.49441 h -0.50404 -0.50403 l -3.20068,-1.49343 -3.20067,-1.49331 -0.45715,0.023 c -0.41475,0.0208 -0.54887,1.6535 -1.44308,2.07389 -0.5422,0.25492 -1.00192,0.50522 -1.02161,0.55625 -0.0195,0.051 -0.0198,0.14245 -4.7e-4,0.20307 0.0366,0.11502 8.86321,4.2575 9.41818,4.42025 h 1.2e-4 c 0.15674,0.0456 0.41022,0.068 0.56691,0.0497 0.19167,-0.0226 1.69201,-0.68438 4.63084,-2.04284 2.39103,-1.10522 4.49522,-2.0812 4.676,-2.16894 0.56994,-0.27661 0.52517,-0.46535 -0.18828,-0.79481 -0.28518,-0.13175 -0.7169,-0.33646 -0.95947,-0.45507 -0.34852,-0.17044 -0.54232,-1.80983 -0.92389,-1.83486 z m -13.813323,4.18598 c -0.32918,0.004 -0.990467,1.6499 -1.847217,2.05187 -1.03403,0.48514 -1.19363,0.60411 -1.07133,0.79858 0.057,0.0905 9.03925,4.318983 9.39542,4.422953 0.0614,0.0179 0.29602,0.0232 0.52126,0.0121 0.38847,-0.0201 0.64737,-0.13175 5.03409,-2.172893 2.54352,-1.18351 4.65567,-2.20115 4.69359,-2.26143 0.12229,-0.19448 -0.0374,-0.31345 -1.07145,-0.79859 -0.97914,-0.45927 -1.01161,-2.586287 -1.47372,-2.580437 l -0.47252,0.007 -3.11148,1.45332 c -1.71133,0.79932 -3.24634,2.013447 -3.41109,2.051217 -0.22142,0.0507 -0.37538,0.0497 -0.59006,-0.004 -0.15974,-0.04 -1.157573,-0.72491 -2.864213,-1.52206 l -3.10295,-1.44939 -0.47254,-0.005 c -0.0578,-4.7e-4 -0.10869,-9.6e-4 -0.15579,-4.7e-4 z"
+           id="path1070"
+           inkscape:connector-curvature="0"
+           sodipodi:nodetypes="cccccccccccccccccccccccccccccccccccccccccscccccccccccc" />
+      </g>
+      <path
+         style="fill:#ffffff;fill-opacity:0.890358;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="m 72.351168,81.377751 c 1.660133,-2.122549 3.107404,-2.336171 6.797629,-4.375332 2.864289,-1.582761 5.139384,-1.56059 8.034136,-0.03426 2.592296,1.366855 7.139447,2.944943 7.110023,4.374832 -0.0656,3.187806 0.02785,1.650498 0.111057,6.013404 0.05713,2.995448 0.830102,7.749208 -2.181951,7.877728 -2.175158,-0.63844 -0.417278,-7.458879 -2.029563,-7.510607 -1.228727,-0.03942 -0.01551,3.511857 -1.24422,3.471863 -2.775518,-0.09034 2.097974,-4.903059 -3.753927,-6.586247 -0.527186,-0.151635 -0.05837,1.11798 -2.303897,1.090432 -1.561181,-0.01915 -1.962336,-2.010565 -2.324864,-1.977917 -2.091371,0.188342 -1.552669,-0.326365 -2.585086,6.840393 0,0 0.464693,5.334783 -1.367289,5.323263 -2.742129,-0.0173 -1.795743,-6.097996 -2.128767,-10.315413 -0.149447,-1.892602 -0.225218,5.690152 -1.943856,4.883578 -1.648858,-5.86811 -0.98005,-8.035103 -0.189425,-9.075717 z"
+         id="path1072"
+         sodipodi:nodetypes="csssscssssscsscc" />
+      <path
+         id="path1074"
+         style="fill:#ffffff;fill-opacity:0.890358;stroke-width:0.812001;stroke-miterlimit:100000;stroke-opacity:0.957475"
+         d="m 72.853613,85.76239 c -0.04916,1.137673 0.618568,3.125467 -0.184336,2.920811 -0.209696,-0.05345 -0.886493,-2.453389 -0.759556,-4.158092 0.140557,-1.887618 0.495364,-1.748661 0.711765,-1.748664 0.216401,-2e-6 0.305928,1.278113 0.232127,2.985945 z"
+         sodipodi:nodetypes="sssss" />
+      <path
+         id="path1076"
+         style="fill:#ffffff;fill-opacity:0.890358;stroke-width:0.812001;stroke-miterlimit:100000;stroke-opacity:0.957475"
+         d="m 75.618385,92.02229 c 0.06712,1.179363 0.585628,2.809413 -0.217276,2.604763 -0.209696,-0.0534 -0.344839,-1.584393 -0.371453,-1.813145 -0.02447,-0.210287 -0.251632,-1.587943 -0.03523,-1.594162 0.216312,-0.0062 0.62396,0.802544 0.623959,0.802544 z"
+         sodipodi:nodetypes="sssss" />
+      <path
+         id="path1078"
+         style="fill:#ffffff;fill-opacity:0.890358;stroke-width:0.36098;stroke-miterlimit:100000;stroke-opacity:0.957475"
+         d="m 81.868188,85.145572 c -0.299553,-0.467313 -0.868992,-1.024395 -0.52817,-1.108365 0.089,-0.02195 0.495393,0.574678 0.558458,0.662482 0.05798,0.08072 0.462197,0.595571 0.384649,0.643253 -0.07753,0.04765 -0.414942,-0.197367 -0.414941,-0.197367 z"
+         sodipodi:nodetypes="sssss" />
+      <path
+         id="path1080"
+         style="fill:#ffffff;fill-opacity:0.890358;stroke-width:0.812001;stroke-miterlimit:100000;stroke-opacity:0.957475"
+         d="m 91.611503,94.418162 c -0.209696,-0.05345 -0.640266,-5.025312 -0.148136,-6.662362 0.220961,4.378188 0.419918,2.923139 0.148136,6.662362 z"
+         sodipodi:nodetypes="ccc" />
+      <path
+         id="path1082"
+         style="fill:#ffffff;fill-opacity:0.890358;stroke-width:0.812001;stroke-miterlimit:100000;stroke-opacity:0.957475"
+         d="m 88.954907,87.508876 c 0.05493,1.340287 -0.432567,2.518072 -0.432567,2.518072 -0.214701,-0.02698 -0.0038,-2.39733 0.0013,-2.627569 0.0047,-0.211654 0.05679,-1.28423 0.05679,-1.28423 0.376919,0.812028 0.369409,1.269869 0.369409,1.269869 z"
+         sodipodi:nodetypes="sssscs" />
+      <path
+         id="path1084"
+         style="fill:#ffffff;fill-opacity:0.918403;stroke-width:3.06898;stroke-miterlimit:100000;stroke-opacity:0.957475"
+         d="m 84.253569,78.137473 c -0.99988,-0.02477 -3.475351,1.261579 -4.653087,1.965897 -0.510518,0.305303 0.976923,1.005581 0.976923,1.005581 0,0 3.017725,1.133413 3.947131,0.515846 0,0 1.471086,-0.487837 1.57335,-1.124255 0.15383,-0.957322 -0.97046,-2.149147 -1.717732,-2.347457 -0.03504,-0.0093 -0.07741,-0.01439 -0.126585,-0.01561 z m -0.508694,1.062904 c 0.0204,5.06e-4 0.03797,0.0025 0.05249,0.0063 0.309896,0.08223 0.791473,0.494336 0.718363,0.755613 0,0 0.154507,0.01731 -0.366173,0.440336 -0.498821,0.405263 -1.484432,0.2803 -1.778902,0.164417 -0.294464,-0.11588 -0.828077,-0.232543 -0.713313,-0.482765 0.109392,-0.238491 1.672878,-0.894197 2.087533,-0.883924 z"
+         sodipodi:nodetypes="ssccassscccssccc" />
+    </g>
+    <path
+       style="fill:#333333;fill-opacity:1;stroke-width:0.313676;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:100000"
+       d="m 82.895231,76.400396 -2.74069,1.275443 c -1.50738,0.701487 -2.99497,1.391917 -3.30576,1.534297 -2.29151,1.04979 -3.27503,1.5282 -3.33455,1.62201 -0.0494,0.0778 -0.0498,0.13923 -10e-4,0.21542 0.0543,0.0856 9.04875,4.31884 9.40857,4.42819 h 2.5e-4 c 0.0548,0.0167 0.28395,0.0202 0.5092,0.008 0.3873,-0.0212 0.66067,-0.13937 5.03617,-2.17703 2.5446,-1.18502 4.65664,-2.20204 4.69346,-2.2601 0.0475,-0.0749 0.0469,-0.13716 -0.001,-0.21432 -0.0595,-0.0939 -1.04305,-0.57221 -3.33456,-1.62201 -0.31077,-0.14237 -1.79838,-0.83281 -3.30577,-1.534297 l -2.74068,-1.275442 h -0.44172 z m 7.35061,7.53152 -3.20288,1.49442 -3.2029,1.49441 h -0.50404 -0.50403 l -3.20068,-1.49343 -3.20067,-1.49331 -0.45715,0.023 c -0.41475,0.0208 -0.54887,0.066 -1.44308,0.48639 -0.5422,0.25492 -1.00192,0.50522 -1.02161,0.55625 -0.0195,0.051 -0.0198,0.14245 -4.7e-4,0.20307 0.0366,0.11502 8.86321,4.2575 9.41818,4.42025 h 1.2e-4 c 0.15674,0.0456 0.41022,0.068 0.56691,0.0497 0.19167,-0.0226 1.69201,-0.68438 4.63084,-2.04284 2.39103,-1.10522 4.49522,-2.0812 4.676,-2.16894 0.56994,-0.27661 0.52517,-0.46535 -0.18828,-0.79481 -0.28518,-0.13175 -0.7169,-0.33646 -0.95947,-0.45507 -0.34852,-0.17044 -0.54232,-0.22233 -0.92389,-0.24736 z m -14.34249,4.18598 c -0.32918,0.004 -0.4613,0.0624 -1.31805,0.46437 -1.03403,0.48514 -1.19363,0.60411 -1.07133,0.79858 0.057,0.0905 9.03925,4.318983 9.39542,4.422953 0.0614,0.0179 0.29602,0.0232 0.52126,0.0121 0.38847,-0.0201 0.64737,-0.13175 5.03409,-2.172893 2.54352,-1.18351 4.65567,-2.20115 4.69359,-2.26143 0.12229,-0.19448 -0.0374,-0.31345 -1.07145,-0.79859 -0.97914,-0.45927 -1.01161,-0.46962 -1.47372,-0.46377 l -0.47252,0.007 -3.11148,1.45332 c -1.71133,0.79932 -3.24634,1.48428 -3.41109,1.52205 -0.22142,0.0507 -0.37538,0.0497 -0.59006,-0.004 -0.15974,-0.04 -1.68674,-0.72491 -3.39338,-1.52206 l -3.10295,-1.44939 -0.47254,-0.005 c -0.0578,-4.7e-4 -0.10869,-9.6e-4 -0.15579,-4.7e-4 z"
+       id="path4436"
+       inkscape:connector-curvature="0"
+       sodipodi:nodetypes="cccccccccccccccccccccccccccccccccccccccccscccccccccccc" />
+    <path
+       style="fill:#ffa309;fill-opacity:0.890358;stroke:none;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="m 72.351168,81.377751 c 1.660133,-2.122549 3.107404,-2.336171 6.797629,-4.375332 2.864289,-1.582761 5.139384,-1.56059 8.034136,-0.03426 2.592296,1.366855 7.139447,2.944943 7.110023,4.374832 -0.0656,3.187806 0.02785,1.650498 0.111057,6.013404 0.05713,2.995448 0.830102,7.749208 -2.181951,7.877728 -2.175158,-0.63844 -0.417278,-7.458879 -2.029563,-7.510607 -1.228727,-0.03942 -0.01551,3.511857 -1.24422,3.471863 -2.775518,-0.09034 2.097974,-4.903059 -3.753927,-6.586247 -0.527186,-0.151635 -0.05837,1.11798 -2.303897,1.090432 -1.561181,-0.01915 -1.962336,-2.010565 -2.324864,-1.977917 -2.091371,0.188342 -1.552669,-0.326365 -2.585086,6.840393 0,0 0.464693,5.334783 -1.367289,5.323263 -2.742129,-0.0173 -1.795743,-6.097996 -2.128767,-10.315413 -0.149447,-1.892602 -0.225218,5.690152 -1.943856,4.883578 -1.648858,-5.86811 -0.98005,-8.035103 -0.189425,-9.075717 z"
+       id="path1304"
+       sodipodi:nodetypes="csssscssssscsscc" />
+    <path
+       id="path5877"
+       style="fill:#fffaf0;fill-opacity:0.890358;stroke-width:0.812001;stroke-miterlimit:100000;stroke-opacity:0.957475"
+       d="m 72.853613,85.76239 c -0.04916,1.137673 0.618568,3.125467 -0.184336,2.920811 -0.209696,-0.05345 -0.886493,-2.453389 -0.759556,-4.158092 0.140557,-1.887618 0.495364,-1.748661 0.711765,-1.748664 0.216401,-2e-6 0.305928,1.278113 0.232127,2.985945 z"
+       sodipodi:nodetypes="sssss" />
+    <path
+       id="path6831"
+       style="fill:#fffaf0;fill-opacity:0.890358;stroke-width:0.812001;stroke-miterlimit:100000;stroke-opacity:0.957475"
+       d="m 75.618385,92.02229 c 0.06712,1.179363 0.585628,2.809413 -0.217276,2.604763 -0.209696,-0.0534 -0.344839,-1.584393 -0.371453,-1.813145 -0.02447,-0.210287 -0.251632,-1.587943 -0.03523,-1.594162 0.216312,-0.0062 0.62396,0.802544 0.623959,0.802544 z"
+       sodipodi:nodetypes="sssss" />
+    <path
+       id="path7746"
+       style="fill:#fffaf0;fill-opacity:0.890358;stroke-width:0.36098;stroke-miterlimit:100000;stroke-opacity:0.957475"
+       d="m 81.868188,85.145572 c -0.299553,-0.467313 -0.868992,-1.024395 -0.52817,-1.108365 0.089,-0.02195 0.495393,0.574678 0.558458,0.662482 0.05798,0.08072 0.462197,0.595571 0.384649,0.643253 -0.07753,0.04765 -0.414942,-0.197367 -0.414941,-0.197367 z"
+       sodipodi:nodetypes="sssss" />
+    <path
+       id="path8112"
+       style="fill:#fffaf0;fill-opacity:0.890358;stroke-width:0.812001;stroke-miterlimit:100000;stroke-opacity:0.957475"
+       d="m 91.611503,94.418162 c -0.209696,-0.05345 -0.640266,-5.025312 -0.148136,-6.662362 0.220961,4.378188 0.419918,2.923139 0.148136,6.662362 z"
+       sodipodi:nodetypes="ccc" />
+    <path
+       id="path8399"
+       style="fill:#fffaf0;fill-opacity:0.890358;stroke-width:0.812001;stroke-miterlimit:100000;stroke-opacity:0.957475"
+       d="m 88.954907,87.508876 c 0.05493,1.340287 -0.432567,2.518072 -0.432567,2.518072 -0.214701,-0.02698 -0.0038,-2.39733 0.0013,-2.627569 0.0047,-0.211654 0.05679,-1.28423 0.05679,-1.28423 0.376919,0.812028 0.369409,1.269869 0.369409,1.269869 z"
+       sodipodi:nodetypes="sssscs" />
+    <path
+       id="path9320"
+       style="fill:#fff2da;fill-opacity:0.918403;stroke-width:3.06898;stroke-miterlimit:100000;stroke-opacity:0.957475"
+       d="m 84.253569,78.137473 c -0.99988,-0.02477 -3.475351,1.261579 -4.653087,1.965897 -0.510518,0.305303 0.976923,1.005581 0.976923,1.005581 0,0 3.017725,1.133413 3.947131,0.515846 0,0 1.471086,-0.487837 1.57335,-1.124255 0.15383,-0.957322 -0.97046,-2.149147 -1.717732,-2.347457 -0.03504,-0.0093 -0.07741,-0.01439 -0.126585,-0.01561 z m -0.508694,1.062904 c 0.0204,5.06e-4 0.03797,0.0025 0.05249,0.0063 0.309896,0.08223 0.791473,0.494336 0.718363,0.755613 0,0 0.154507,0.01731 -0.366173,0.440336 -0.498821,0.405263 -1.484432,0.2803 -1.778902,0.164417 -0.294464,-0.11588 -0.828077,-0.232543 -0.713313,-0.482765 0.109392,-0.238491 1.672878,-0.894197 2.087533,-0.883924 z"
+       sodipodi:nodetypes="ssccassscccssccc" />
+  </g>
+</svg>

+ 1 - 0
setup.cfg

@@ -18,6 +18,7 @@ install_requires =
     pyside6
     outdated
     pyqtdarktheme
+    importlib-resources
 packages = find_namespace:
 include_package_data = True