I have a Qt plugin, and i have a button browse_btn to browse for an output folder.  I use the QFileDialog.getExistingDirectory function and it all works fine. However if I close the plugin and open it again, then click the pushbutton to add a path, the opened window for choosing the path will re-open after I choose a path or close it. If I close the plugin a open it again the 'choose path' window will reopen 3 time and so on...  The similar problem  and  and probably , but since there is no code provided I cannot apply it to solve my problem.  The exact code is following:  self.dlg.browse_btn.clicked.connect(self.set_output)  def set_output(self):     folder_path = str(QFileDialog.getExistingDirectory(self.dlg, u"Pick a folder"))     if not folder_path:         return None   I think this happens because each time I open-close the plugin the separate connection is created with self.dlg.browse_btn.clicked.connect(self.set_output), and it only disconnects after I relaunch QGIS or use
32746
I have a plugin with a function (triggered by a button) that selects a specific layer by name, then shows its attribute table. When I close the plugin and open it again, the attribute table pops up twice, and repeating this keeps adding another table popup. What's wrong?  Code:  def showTable(self):     for lyrs in QgsMapLayerRegistry.instance().mapLayers().values():         if lyrs.name() == "TestFeatures":             lyrTest = lyrs     self.iface.showAttributeTable(lyrTest)
80632
I am writing a simple plugin that finds buffer. My gui has 2 combo box and 1 Line edit. The first combo box will have a drop down of values  from column 'States' and 2nd combo will have a drop down of values from column 'Cities'. Note that the Cities will be filtered in the combo box depending on the states selected. And 3rd Lineedit gets a distance from the user. As a result, I want buffer for the cities (from the 2nd combo box) with the user specified 'distance value' given in the lineedit box.I tried QgsGeometryAnalyzer().buffer() function in QGIS API. But the first argument is a layer for the above mentioned function. Instead i want my gui to take value from the city combo and lineedit and find buffer. How to accomplish. Sorry for the lengthy post.
101639
How can I copy the path to a folder or a file? The Info Dialog doesn't allow me to copy the information that stands there ...    Is there an easy way to do this?
66636
I would normally open the parent folder and search for * in order to select all of the files in subfolders, but in this instance, I have over 1,000,000 files that I need to sort through, so my explorer often crashes when trying to copy that many files through the GUI. I am not sure how much more effective this will be through the command prompt or a batch file, but it is worth a try, I suppose.  What I need to do is make it so that  |parent |    |123 |    |    123abc.png |    |456 |    |    456def.png |    |789 |    |    789ghi.png   becomes  |parent |    123abc.png |    456def.png |    789ghi.png   Yes, my actual file structure has the first 3 characters of the file name given to the folder name, if that can help at all in sorting these.
66910
I have a python script that checks file path names for corresponding files in a drive location. All of the inputs were originally hard coded, and it works well enough:      import arcpy     import os     shp = r"C:\Users\dotwell\Desktop\Locations.shp"     fields = ["ZdriveLoc"]     f = open (r"C:\Users\dotwell\Desktop\ValMapsTest.txt", "w")     cursor = arcpy.da.SearchCursor (shp, fields)         for row in cursor:             Roll=str(row[0])             if not os.path.exists(Roll):             f.write(Roll + os.linesep)       f.close()   I'm trying to create an ArcGIS script tool from this, and I've only had partial success. I can use   shp = arcpy.GetParameterAsText(0)   to allow the user to select the shapefile. I'd like to then have a drop down list of the fields in that shapefile for the user to select the field that contains the path names, but I can't get it to work. Can someone show me how to generate the drop down? Here's my latest try. It works, but requires the user to type in the field name. It would also be nice for the user to designate the output text file name and location.   import arcpy import os shapefile = arcpy.GetParameterAsText(0) field = arcpy.GetParameterAsText(1) f = open (r"C:\Users\dotwell\Desktop\ValMapsTemp.txt", "w") cursor = arcpy.da.SearchCursor (shapefile, field) for row in cursor:     Roll=str(row[0])     if not os.path.exists(Roll):         f.write(Roll + os.linesep)   f.close()   Here are the parameters in my ArcGIS script tool:
111735
I have some QGIS projects that I've been using for long time, adding and removing layers, updating reference to deleted or moved files etc.  Opening the qgs file with a text editor I see that it contains numerous references to different files, and this references are not showed on the Layer tree pane.  I have three different cases: references to existing file, references to missing files, references to database connections. I got aware of this when I opened my project on another machine, and QGIS reported a missing database connection to vector tables not present in the layer tree view.  Manually deleting references from the qgs file solved the problem, but I'm managing huge projects and it's near to impossible to manually check the project consistency. I've tried the "Remove empty layers" plugin, but the ones I'm trying to remove are not empty layers.   Is there any way to 'purge' qgis file?
5826
I am using the  plugin  I am looking for way to refresh the page when in some circumstances when the dialog is closed.  Is there a way to capture a close event from the dialog?  I know I can run code when the close button is clicked but that doesn't cover the user closing with escape or the x in the top right corner.
77484
I'm writing a generic script which involves writing shapefiles to a directory which are then merged together. After writing the files out to the Output folder, I'm trying to get the saga:mergeshapeslayers algorithm to merge all the files in the Output folder. I have used the Model Builder and although it is helpful to an extent, I find that it is used for specific purposes whereas I am attempting to make a script for generic purposes.   Code:  ##Test=name ##Select_folder=folder ##Result=output vector  import os import glob  path_1 = Select_folder path = path_1 os.chdir(path)  def function():      output = glob.glob(path_1 + './*.shp')     x = 0      while output[x]:         for fname in glob.glob("*.shp"):             outputs_1 = processing.runandload("qgis:fieldcalculator", output[x], 'Number', 1, 10, 0, True, 1 , "C:\Users\Me\Desktop\Output\\"  + fname)             multiple_0 = glob.glob("*.shp")             x = x + 1          if x + 1 &gt; len(output):             processing.runalg("saga:mergeshapeslayers", output[0], ";".join(multiple_0) , Result)             break         else:             continue  if path_1:     function() else:    pass
44242
I use LyX 2.0.4 (on Mac OS 10.7) and would like it to do the following:   whenever I hit "View" it should automatically save the pdf output of the lyx file in the same folder the lyx file resides. Whenever I hit "View" again it should overwrite the older version of the pdf. Is that possible?  This is similar to the behavior I know from TeXShop.
72340
I try to write a PyQGIS script similar to this: .  Basically there are two loops to pan the mapCanvas, refresh the mapCanvas and export the mapCanvas to *.png.  iface.mapCanvas().setExtent(QgsRectangle(xmin, ymin, xmax, ymax)) time.sleep(5) iface.mapCanvas().refresh() time.sleep(5) iface.mapCanvas().saveAsImage("D:/GE"+str(i)+"to"+str(j)+"img.png" )   If I execute this code line by line in the Python Console it is working fine. If I use it in a loop georeferenced png will be exported but they are either blank or contain all the same content. As you see above I tried to use time.sleep() to have a timeslot for the map to update. But was not successful. As  suggested I also tried:  for layer in qgis.utils.iface.mapCanvas().layers():     layer.triggerRepaint()   Same problem here: works line by line in the Python Console but not in a loop.  How to refresh mapCanvas while PyQGIS-script is running?  (QGIS Version 2.14.3)
9945
I always used to open a new VLC window; go to "open file"...etcetera when I wanted to watch something because when I click on a file in Windows Explorer and chose "open with" or just clicked on the file or right-clicked to choose "play with VLC" it always opened in an old already used VLC window.  Is there any way to get VLC to use a new one without always resorting to: Open VLC, "open file", find file etcetera?
17041
I have a button in my menu named "New File" as shown:    and I want when I click on the "New File" button to imitate what the Blender File->New does, where a check message box appear first confirming that you want to reload the Start-up File and if pressed then the startup file is loaded as shown below.    This is my script, when I press on new it opens the startup file without checking:  class NewFile(bpy.types.Operator):     """New File"""     bl_idname = "wm.newfile"       bl_label = "New File"     bl_options = {'REGISTER', 'UNDO'}      def execute(self, context):         bpy.ops.wm.read_homefile()         return {"FINISHED"}
20264
This may be a silly question, and I think I have looked elsewhere to find the answer...  Might be a path issue, but when I open the command line and type from the C:\&gt;: cd D:\  I cannot get to the D drive.  Even if I type: cd D:\&lt;folder name&gt;  The command.exe will auto-complete the line with the tab key, so it knows where I'm at.  It just doesn't print to screen the result or actually get me there.  This problem exists for the network drives as well. Now, if I use the chdir (cd) command like this: chdir D: or cd d: I get the print out of the D:\ below the command but it still says I'm in the C:\. I feel like I'm missing something simple.
52931
I created a shortcut via "make link" option. When I enter to this shortcut's folder I can't see any folders above it so I can't easily navigate to them.  Is there a way to go one folder up in the GUI? Maybe a hotkey? (Can't do cd .. this time ^__^ ).      In Windows for example I am indeed able to navigate in the way I describe, here is a Win10 image that explains it:
75110
I have clicked an image in a slide show and it generates a new window. Once the window opens I need to bring focus on new window and do some stuff. I have attached my code below, but it is not successful.  @Test public void testCreateAccount() throws Exception{  //OPEN manorama online  url driver.navigate().to("http://www.manoramaonline.com/cgi-bin/MMOnline.dll/portal/ep/home.do?tabId=0&amp;BV_ID=@@@");  // to click a link inside a slide show  while (!driver         .findElement(                 By.xpath("/html/body/div[2]/div[2]/div[4]/div/div/div/div/center/div/div[2]/span/div/a/img"))         .isDisplayed()) { } driver.findElement(         By.xpath("/html/body/div[2]/div[2]/div[4]/div/div/div/div/center/div/div[2]/span/div/a/img"))         .click();    String newwindowTitle = driver.getTitle();  switchWindow(newwindowTitle);  }  protected static boolean switchWindow(String title) throws IOException {      String currentWindow = driver.getWindowHandle();     Set&lt;String&gt; availableWindows = driver.getWindowHandles();     if (!availableWindows.isEmpty()) {     for (String windowId : availableWindows) {     if (driver.switchTo().window(windowId).getTitle().equals(title)) {     return true;     } else {         driver.switchTo().window(currentWindow);     }}}      return false;        }
71532
After hitting ⌘-O, how can I navigate my folders and select a file to open using only my keyboard?   In particular, how can I get the focus into the folder list? (From there I can use arrows or start typing the first letters of the desired file/folder.)  In some programs I can rely on hitting TAB 5 times, but this isn't reliable and I figure there must be a better way.
77407
Is there some plist I can edit to decrease the number of files that Finder's Get Info function will open separate info windows for?  The number of Get Info windows that will open simultaneously is . The windows slowly appear one at a time, and once they finally finish appearing I have to close them all one at a time. Pure madness, and whoever chose the default value for this feature should go outside and think about what they've done.   If I get info on thirty-six files, it finally automatically consolidates them into a  I would like to change this threshold of 36 to something reasonable, like 4.  I know about the  to open the Inspector and Summary Info windows, however sometimes I accidentally forget to hold Option or Control, and I would like to eliminate the possibility of this happening by accident.   A satisfactory alternate solution would be if there were a way to make Get Info always open a Summary Info window instead of opening separate file info windows.  MacBook Pro (Retina, Mid 2012) running 10.10.5.