Selaa lähdekoodia

wxGUI: Add new icons to datacatalog for actions avaliable in context menu (continue) (#830)

Added icons for downloading and creating a location. Simplified tooltip strings, reordered icons.

Co-authored-by: Anna Petrasova <kratochanna@gmail.com>
Linda Kladivova 4 vuotta sitten
vanhempi
commit
14025443ca

BIN
gui/icons/grass/location-add.png


+ 43 - 76
gui/icons/grass/location-add.svg

@@ -5,39 +5,11 @@
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:svg="http://www.w3.org/2000/svg"
    xmlns="http://www.w3.org/2000/svg"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   inkscape:export-ydpi="96"
-   inkscape:export-xdpi="96"
-   inkscape:export-filename="C:\Users\kladivoval\Desktop\location-add.png"
-   id="svg8"
-   version="1.1"
-   viewBox="0 0 6.3499999 6.3499999"
-   height="24"
    width="24"
-   sodipodi:docname="location-add.svg"
-   inkscape:version="1.0 (4035a4fb49, 2020-05-01)">
-  <sodipodi:namedview
-     inkscape:document-rotation="0"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1"
-     objecttolerance="10"
-     gridtolerance="10"
-     guidetolerance="10"
-     inkscape:pageopacity="0"
-     inkscape:pageshadow="2"
-     inkscape:window-width="1920"
-     inkscape:window-height="1137"
-     id="namedview23"
-     showgrid="false"
-     inkscape:zoom="18.863213"
-     inkscape:cx="6.1128494"
-     inkscape:cy="12"
-     inkscape:window-x="-8"
-     inkscape:window-y="-8"
-     inkscape:window-maximized="1"
-     inkscape:current-layer="svg8" />
+   height="24"
+   viewBox="0 0 6.3499999 6.3499999"
+   version="1.1"
+   id="svg8">
   <defs
      id="defs2" />
   <metadata
@@ -48,72 +20,67 @@
         <dc:format>image/svg+xml</dc:format>
         <dc:type
            rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-        <dc:title />
+        <dc:title></dc:title>
       </cc:Work>
     </rdf:RDF>
   </metadata>
   <g
-     id="g108"
-     transform="matrix(0.26458333,0,0,0.26458333,0.01182026,-2.0310632)"
-     fill="none">
+     style="fill:none;stroke-width:1.03626227"
+     transform="matrix(0.2553238,0,0,0.25532554,0.01703996,-2.1568621)"
+     id="g108">
     <g
-       id="g104"
-       stroke-width="0.8"
-       stroke="#5489c4">
+       style="stroke:#5489c4;stroke-width:0.82900983"
+       id="g104">
       <path
-         id="path94"
-         d="m 12.000001,10.286844 c 7.115911,3.532057 6.099353,16.777269 0,19.426312" />
+         style="stroke-width:0.82900983"
+         d="m 12.000001,10.286844 c 7.115911,3.532057 6.099353,16.777269 0,19.426312"
+         id="path94" />
       <path
-         id="path96"
-         d="M 0.81785277,20.000001 H 23.182148" />
+         style="stroke-width:0.82900983"
+         d="M 0.81785277,20.000001 H 23.182148"
+         id="path96" />
       <path
-         id="path98"
-         d="m 2.1902082,14.688719 c 5.6927292,0.758755 13.8252008,0.758755 19.5179298,0" />
+         style="stroke-width:0.82900983"
+         d="m 2.1902082,14.688719 c 5.6927292,0.758755 13.8252008,0.758755 19.5179298,0"
+         id="path98" />
       <path
-         id="path100"
-         d="m 2.1902082,25.311281 c 5.6927292,-0.758754 13.8252008,-0.758754 19.5179298,0" />
+         style="stroke-width:0.82900983"
+         d="m 2.1902082,25.311281 c 5.6927292,-0.758754 13.8252008,-0.758754 19.5179298,0"
+         id="path100" />
       <path
-         id="path102"
-         d="m 12.000001,10.286844 c -6.0993537,2.649043 -7.1159126,15.894256 0,19.426312" />
+         style="stroke-width:0.82900983"
+         d="m 12.000001,10.286844 c -6.0993537,2.649043 -7.1159126,15.894256 0,19.426312"
+         id="path102" />
     </g>
     <path
-       id="path106"
-       transform="matrix(0.94418617,0,0,0.8171557,16.859375,8.715626)"
-       stroke-width="1.28353"
-       stroke="#3e74b2"
+       style="stroke:#3e74b2;stroke-width:1.33007383"
        d="m 6.9656949,13.809332 a 12.112323,12.156691 0 1 1 -24.2246459,0 12.112323,12.156691 0 1 1 24.2246459,0 z"
-       inkscape:export-xdpi="96"
-       inkscape:export-ydpi="96" />
+       transform="matrix(0.94418617,0,0,0.8171557,16.859375,8.715626)"
+       id="path106" />
   </g>
   <g
-     id="g844"
-     transform="matrix(0.21452698,0,0,0.21452698,-0.48540003,-0.51719001)">
+     transform="matrix(0.21452698,0,0,0.21452698,-0.48540003,-0.51719001)"
+     id="g844">
     <rect
-       inkscape:export-ydpi="96"
-       inkscape:export-xdpi="96"
-       id="rect836"
-       y="19"
-       x="19"
-       width="13"
-       ry="2.6149368"
-       rx="2.6149371"
+       style="fill:#5a8c5a"
        height="13"
-       style="fill:#5a8c5a" />
+       rx="2.6149371"
+       ry="2.6149368"
+       width="13"
+       x="19"
+       y="19"
+       id="rect836" />
     <path
-       id="path838"
+       d="m 21.6,25.499999 h 7.8"
        style="overflow:visible;fill:#ffffff;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.6;stroke-linecap:round;stroke-linejoin:round"
-       d="m 21.6,25.499999 h 7.8" />
+       id="path838" />
     <path
-       inkscape:export-ydpi="96"
-       inkscape:export-xdpi="96"
-       id="path840"
+       d="M 25.5,29.399999 V 21.6"
        style="overflow:visible;fill:#ffffff;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.6;stroke-linecap:round;stroke-linejoin:round"
-       d="M 25.5,29.399999 V 21.6" />
+       id="path840" />
     <path
-       inkscape:export-ydpi="96"
-       inkscape:export-xdpi="96"
-       id="path842"
+       style="opacity:0.3;fill:#fcffff;fill-rule:evenodd"
        d="m 20.3,25.499999 h 10.4 c 0,0 0,0 0,-2.6 C 30.7,20.3 30.05,20.3 25.5,20.3 c -4.55,0 -5.2,0 -5.2,2.599999 0,2.6 0,2.6 0,2.6 z"
-       style="opacity:0.3;fill:#fcffff;fill-rule:evenodd" />
+       id="path842" />
   </g>
 </svg>

BIN
gui/icons/grass/location-download.png


+ 52 - 86
gui/icons/grass/location-download.svg

@@ -5,39 +5,11 @@
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:svg="http://www.w3.org/2000/svg"
    xmlns="http://www.w3.org/2000/svg"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   inkscape:version="1.0 (4035a4fb49, 2020-05-01)"
-   sodipodi:docname="location-download.svg"
-   width="24"
-   height="24"
-   viewBox="0 0 6.3499999 6.3499999"
-   version="1.1"
    id="svg8"
-   inkscape:export-filename="C:\Users\kladivoval\Desktop\location-download.png"
-   inkscape:export-xdpi="96"
-   inkscape:export-ydpi="96">
-  <sodipodi:namedview
-     inkscape:current-layer="svg8"
-     inkscape:window-maximized="1"
-     inkscape:window-y="-8"
-     inkscape:window-x="-8"
-     inkscape:cy="12"
-     inkscape:cx="12.929979"
-     inkscape:zoom="30.625"
-     showgrid="false"
-     id="namedview23"
-     inkscape:window-height="1137"
-     inkscape:window-width="1920"
-     inkscape:pageshadow="2"
-     inkscape:pageopacity="0"
-     guidetolerance="10"
-     gridtolerance="10"
-     objecttolerance="10"
-     borderopacity="1"
-     bordercolor="#666666"
-     pagecolor="#ffffff"
-     inkscape:document-rotation="0" />
+   version="1.1"
+   viewBox="0 0 6.3499999 6.3499999"
+   height="24"
+   width="24">
   <defs
      id="defs2" />
   <metadata
@@ -48,80 +20,74 @@
         <dc:format>image/svg+xml</dc:format>
         <dc:type
            rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-        <dc:title />
+        <dc:title></dc:title>
       </cc:Work>
     </rdf:RDF>
   </metadata>
   <g
-     fill="none"
-     transform="matrix(0.26458333,0,0,0.26458333,0.01182026,-2.0310632)"
-     id="g108">
+     style="fill:none;stroke-width:1.03626227"
+     id="g108"
+     transform="matrix(0.2553238,0,0,0.25532554,0.01703996,-2.2342277)">
     <g
-       stroke="#5489c4"
-       stroke-width="0.8"
+       style="stroke:#5489c4;stroke-width:0.82900983"
        id="g104">
       <path
-         d="m 12.000001,10.286844 c 7.115911,3.532057 6.099353,16.777269 0,19.426312"
-         id="path94" />
+         style="stroke-width:0.82900983"
+         id="path94"
+         d="m 12.000001,10.286844 c 7.115911,3.532057 6.099353,16.777269 0,19.426312" />
       <path
-         d="M 0.81785277,20.000001 H 23.182148"
-         id="path96" />
+         style="stroke-width:0.82900983"
+         id="path96"
+         d="M 0.81785277,20.000001 H 23.182148" />
       <path
-         d="m 2.1902082,14.688719 c 5.6927292,0.758755 13.8252008,0.758755 19.5179298,0"
-         id="path98" />
+         style="stroke-width:0.82900983"
+         id="path98"
+         d="m 2.1902082,14.688719 c 5.6927292,0.758755 13.8252008,0.758755 19.5179298,0" />
       <path
-         d="m 2.1902082,25.311281 c 5.6927292,-0.758754 13.8252008,-0.758754 19.5179298,0"
-         id="path100" />
+         style="stroke-width:0.82900983"
+         id="path100"
+         d="m 2.1902082,25.311281 c 5.6927292,-0.758754 13.8252008,-0.758754 19.5179298,0" />
       <path
-         d="m 12.000001,10.286844 c -6.0993537,2.649043 -7.1159126,15.894256 0,19.426312"
-         id="path102" />
+         style="stroke-width:0.82900983"
+         id="path102"
+         d="m 12.000001,10.286844 c -6.0993537,2.649043 -7.1159126,15.894256 0,19.426312" />
     </g>
     <path
-       inkscape:export-ydpi="96"
-       inkscape:export-xdpi="96"
-       d="m 6.9656949,13.809332 a 12.112323,12.156691 0 1 1 -24.2246459,0 12.112323,12.156691 0 1 1 24.2246459,0 z"
-       stroke="#3e74b2"
-       stroke-width="1.28353"
+       style="stroke:#3e74b2;stroke-width:1.33007383"
+       id="path106"
        transform="matrix(0.94418617,0,0,0.8171557,16.859375,8.715626)"
-       id="path106" />
+       d="m 6.9656949,13.809332 a 12.112323,12.156691 0 1 1 -24.2246459,0 12.112323,12.156691 0 1 1 24.2246459,0 z" />
   </g>
   <rect
-     inkscape:export-ydpi="96"
-     inkscape:export-xdpi="96"
      fill="#3c5a6e"
-     height="2.7721853"
-     rx="0.50655389"
-     width="2.7721853"
-     x="3.5956585"
-     y="3.5754879"
+     style="stroke-width:0.252016"
      id="rect171"
-     style="stroke-width:0.252016" />
+     y="3.5754879"
+     x="3.5956585"
+     width="2.7721853"
+     rx="0.50655389"
+     height="2.7721853" />
   <path
-     inkscape:export-ydpi="96"
-     inkscape:export-xdpi="96"
-     d="m 3.7758801,5.0554289 2.4745562,-0.00276 v -0.549895 c 0,-0.8221024 -0.2749506,-0.8221024 -1.2372781,-0.8221024 -0.9623273,0 -1.2372781,0 -1.2372781,0.824852 z"
+     opacity="0.3"
      fill="#fcffff"
      fill-rule="evenodd"
-     opacity="0.3"
+     style="stroke-width:0.27495"
      id="path173"
-     style="stroke-width:0.27495" />
-  <g
-     fill="none"
-     stroke="#ffffff"
-     stroke-linecap="round"
-     stroke-linejoin="round"
-     id="g179"
-     transform="matrix(0.29150493,0,0,0.29150493,-0.43979886,-0.40841962)">
-    <path
-       inkscape:export-ydpi="96"
-       inkscape:export-xdpi="96"
-       d="m 17.7,15.75 h -2.5 v 5.5 h 2.5"
-       stroke-width="1.5"
-       id="path175" />
-    <path
-       inkscape:export-ydpi="96"
-       inkscape:export-xdpi="96"
-       d="m 19.493,20.48 -1.5,-1.99 1.5,-1.99 m 3.007,1.98 h -3.397"
-       id="path177" />
-  </g>
+     d="m 3.7758801,5.0554289 2.4745562,-0.00276 v -0.549895 c 0,-0.8221024 -0.2749506,-0.8221024 -1.2372781,-0.8221024 -0.9623273,0 -1.2372781,0 -1.2372781,0.824852 z" />
+  <path
+     d="M 4.6162555,4.0877152 H 4.0948412 v 1.7934144 h 0.5336323"
+     id="path175"
+     style="fill:none;stroke:#ffffff;stroke-width:0.30506459;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none" />
+  <path
+     d="M 5.3115655,5.7171115 4.8280238,4.9815065 5.2942866,4.2631804 M 6.0557555,4.9785915 H 5.1027331"
+     id="path177"
+     style="fill:none;stroke:#ffffff;stroke-width:0.26511249;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none" />
+  <path
+     id="path826"
+     d="M 4.6162555,4.0877152 V 4.3715309"
+     style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:0.30506459;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+  <path
+     id="path826-5"
+     d="M 4.6284735,5.5973139 V 5.8811296"
+     style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:0.30506459;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
 </svg>

+ 10 - 0
gui/wxpython/datacatalog/catalog.py

@@ -107,6 +107,16 @@ class DataCatalog(wx.Panel):
         db_node, loc_node, mapset_node = self.tree.GetCurrentDbLocationMapsetNode()
         self.tree.CreateMapset(db_node, loc_node)
 
+    def OnCreateLocation(self, event):
+        """Create new location"""
+        db_node, loc_node, mapset_node = self.tree.GetCurrentDbLocationMapsetNode()
+        self.tree.CreateLocation(db_node)
+
+    def OnDownloadLocation(self, event):
+        """Download location to current grass database"""
+        db_node, loc_node, mapset_node = self.tree.GetCurrentDbLocationMapsetNode()
+        self.tree.DownloadLocation(db_node)
+
     def SetRestriction(self, restrict):
         """Allow editing other mapsets or restrict editing to current mapset"""
         self.tree.SetRestriction(restrict)

+ 10 - 0
gui/wxpython/datacatalog/frame.py

@@ -124,6 +124,16 @@ class DataCatalogFrame(wx.Frame):
         db_node, loc_node, mapset_node = self.tree.GetCurrentDbLocationMapsetNode()
         self.tree.CreateMapset(db_node, loc_node)
 
+    def OnCreateLocation(self, event):
+        """Create new location"""
+        db_node, loc_node, mapset_node = self.tree.GetCurrentDbLocationMapsetNode()
+        self.tree.CreateLocation(db_node)
+
+    def OnDownloadLocation(self, event):
+        """Download location online"""
+        db_node, loc_node, mapset_node = self.tree.GetCurrentDbLocationMapsetNode()
+        self.tree.DownloadLocation(db_node)
+
     def SetRestriction(self, restrict):
         """Allow editing other mapsets or restrict editing to current mapset"""
         self.tree.SetRestriction(restrict)

+ 14 - 4
gui/wxpython/datacatalog/toolbars.py

@@ -28,16 +28,22 @@ icons = {
         label=_("Reload current GRASS mapset only")),
     'unlocked': MetaIcon(
         img='unlocked',
-        label=_("Click to restrict editing to current mapset only")),
+        label=_("Restrict editing to current mapset only")),
     'locked': MetaIcon(
         img='locked',
-        label=_("Click to allow editing other mapsets")),
+        label=_("Allow editing other mapsets")),
     'addGrassDB': MetaIcon(
         img='grassdb-add',
-        label=_("Click to add new GRASS database")),
+        label=_("Add new GRASS database")),
     'addMapset': MetaIcon(
         img='mapset-add',
-        label=_("Click to add new mapset in current location"))
+        label=_("Create new mapset in current location")),
+    'addLocation': MetaIcon(
+        img='location-add',
+        label=_("Create new location in current GRASS database")),
+    'downloadLocation': MetaIcon(
+        img='location-download',
+        label=_("Download sample location to current GRASS database"))
 }
 
 
@@ -79,6 +85,10 @@ class DataCatalogToolbar(BaseToolbar):
                                       self.OnSetRestriction, wx.ITEM_CHECK),
                                      ("addGrassDB", icons['addGrassDB'],
                                       self.parent.OnAddGrassDB),
+                                     ("addLocation", icons['addLocation'],
+                                      self.parent.OnCreateLocation),
+                                     ("downloadLocation", icons['downloadLocation'],
+                                      self.parent.OnDownloadLocation),
                                      ("addMapset", icons['addMapset'],
                                       self.parent.OnCreateMapset)
                                      ))

+ 18 - 9
gui/wxpython/datacatalog/tree.py

@@ -688,20 +688,23 @@ class DataCatalogTree(TreeView):
         """Create new mapset"""
         self.CreateMapset(self.selected_grassdb[0], self.selected_location[0])
 
-    def OnCreateLocation(self, event):
+    def CreateLocation(self, grassdb_node):
         """
-        Location wizard started
+        Creates new location interactively and adds it to the tree.
         """
         grassdatabase, location, mapset = (
-            create_location_interactively(self,
-                                          self.selected_grassdb[0].data['name'])
+            create_location_interactively(self, grassdb_node.data['name'])
         )
-        if location is not None:
+        if location:
             item = self._model.SearchNodes(name=grassdatabase, type='grassdb')
             if not item:
                 self.InsertGrassDb(name=grassdatabase)
             self.ReloadTreeItems()
 
+    def OnCreateLocation(self, event):
+        """Create new location"""
+        self.CreateLocation(self.selected_grassdb[0])
+
     def OnRenameMapset(self, event):
         """
         Rename selected mapset
@@ -987,16 +990,22 @@ class DataCatalogTree(TreeView):
                    message=_("Unable to delete location: %s") % e,
                    showTraceback=False)
 
-    def OnDownloadLocation(self, event):
+    def DownloadLocation(self, grassdb_node):
         """
-        Download location online
+        Download new location interactively.
         """
-        grassdatabase, location, mapset = download_location_interactively(
-                self, self.selected_grassdb[0].data['name']
+        grassdatabase, location, mapset = (
+            download_location_interactively(self, grassdb_node.data['name'])
         )
         if location:
             self.ReloadTreeItems()
 
+    def OnDownloadLocation(self, event):
+        """
+        Download location online
+        """
+        self.DownloadLocation(self.selected_grassdb[0])
+
     def OnDisplayLayer(self, event):
         """
         Display layer in current graphics view