QFileDialog: default file name based on current directory - pyqt

I was wondering is it possible to make the default file name dynamically change based on the current directory in the dialog? I think it is not possible with QFileDialog.getSaveFileName(), but could it be possible with customized QFileDialog? Here is a screenshot of the ideal dialog:
I would appreciate all help!

Related

Hyperlink in Task Dialog footer to CHM? [duplicate]

I have created a .CHM file and then when I open it in c# I get the First topic. I want to open it to a specified topic.
This is the code I use right now to open it.
Help.ShowHelp(this, "./Resources/ServerHelp.chm");
I want to be able to open it to a specific topic like Audio. I tried using
Help.ShowHelp(this, "./Resources/ServerHelp.chm", HelpNavigator.Topic, "Audio");
and it showed me page not found. Can i get some Help with my Help please !! :P
This can be achieved by the following steps:
Identify what names the chm uses to refer the internal topics. This is done by
Open the CHM file, and right click in the topic page and select Properties.
The property called: Address (URL) Contains the topic page name at its end.
Here is an example:
mk:#MSITStore:C:\Program%20Files\Silsila%2011\Silsila.chm::/Audio.htm
Here the topic page name is "Audio.htm"
Call the Help.ShowHelp() function with the correct parameters as shown below
Help.ShowHelp(this, "./Resources/Silsila.chm", HelpNavigator.Topic, "Audio.htm");
That should do it. you can fine the topic name of the pages you want using Step 1, and then use Step 2 to open the help file on that page.
The same also works to create a windows shortcut opening a specific page. Use that as "target" command line :
C:\Windows\hh.exe ms-its:[file_name.chm]::[page_name.htm]
If you do not know [page_name]: from the chm help viewer, try to print the target page on a virtual printer like PdfCreator. The output filename automaticaly generated will probably contain [page_mane].
With thanks to sazr for the intial syntax !

How do I set build action for a new file?

I added a new sql file to a folder. Now I want to change the properties of the file to be an embedded resource. When I right-click the file and go to Properties, it only shows the "General" section which is the name and location of the file.
If I do the same for pre-existing files, they show build actions and other information which would allow me to change the type of resource it is.
How do I get that to show up for a new file?
We have created an issue in our tracker, it is obviously a bug. So you can track it there:
https://youtrack.jetbrains.com/issue/RIDER-31875

How can I use a dialog to define the program group name in Installshield 2015

I am currently trying to expand our installation program with an option for the user to specify the name of the program group where shortcuts are created under the start menu. (I am aware that this is a somewhat outdated concept)
I am using InstallShield 2015.
I created a localizable property named [PROGRAMGROUP_NAME]. This has automatically created an {ID_STRING46} which I've set to the desired default value. So far so good.
I managed to create a custom dialog with an edit control, which is linked to the above property.
Now comes the tricky part: Under Shortcuts, under "Programs Menu" I first want to add a folder with the program group name, under which to place several shortcuts.
If I enter [PROGRAMGROUP_NAME] that is literally what the name becomes. If I use {ID_STRING46}, it uses the default value, and not what I've entered in the dialog.
Incidentally, when I tried to rename ID_STRING46 to something more meaningful, other things started going wrong so I've left that as is.
What is going wrong here? How do I get the value of the property to be used for the folder name?
EDIT
I am trying to use a custom action now, but I have trouble defining it. My Dialog that sets the property is after CostFinalize, so I assume I have to use SetDirectory - but I have trouble defining it. I get an error stating "could not access network location "
EDIT
I've managed to progress a step. I have manually added a directory with key DIRECTORY_PROGRAM_GROUP (important that it's all caps to make it public) to the directory table. Then, I use a custom action to set that directory to the desired value [ProgramMenuFolder][PROGRAM_GROUP_NAME] after I've run my dialog, and I've modified the shortcut to be created in that folder.
Seems to work great, however, now the program group is no longer removed when uninstalling...
Shortcuts are installed to folders, and the name of the folders below ProgramMenuFolder become the program group as you describe it. So you will need to either build up the Directory table (either directly---note that the DefaultDir column is localizable, and there may already be a string you can update---or through the Files and Folders view) to do what you want, or use custom actions (set property, if before costing; set directory, if after costing) to adjust the location to which your shortcut is installed.
As for the problems renaming ID_STRING46, odds are you didn't update a reference after you changed the name of the string. The simplest way to track down where these are may be to examine differences in the built installer (perhaps using InstallShield's MSI Diff) and then update the relevant references using the direct editor if you can't find them in the normal views.

About Directory Contents in asp.net

I have a directory and I want to save a image in that directory.
How would I know an image already exists in that directory or not?
You can determine if the file exists (by name) using the File.Exists method. There is, however, the possibility of a file being saved with the same name between the time of checking and saving your own.
In a web application I often used mapped GUID values as file names.
Anyway, I think this is what you're asking, though it isn't greatly conveyed as to your exact current predicament.

How Do I Let the User Save to a Directory?

Language: C++
Development Environment: Microsoft Visual C++
Libraries Used: MFC
Question: I am creating a large preference editing tool with pages of dialogs with different settings for the user to customize. Each "page" of settings will be written to its own XML file.
The user will have two options: 1) Save These, where they will be prompted to specify which pages they wish to save, and 2) Save All, which will save each page into their own XML files.
For the Save All function, I'd like it if the user only had to specify a directory into which he/she wishes to save all of the files. I'm fairly certain that I have to use the FolderBrowserDialog class, but I'm not sure how. I imagine it's very similar to an OpenFile dialog or a SaveFile dialog with one of the arguments specifying to save to a directory.
I found the FolderBrowserDialog class on the MSDN, but it wasn't very helpful. Any help would be greatly appreciated!
SOLUTION: I have found a working solution. It is essentially a combination of a few answers above, but for people seeking a similar solution in the future, I referenced THIS page. The author created a wrapper class for the messy code that is needed to create a directory-chooser dialog. Thank you for all the suggestions. You all helped me along in the right direction. Cheers.
~ Jon
Use ::SHBrowseForFolder(). It shows the standard "browse for folder dialog" (at least up to Windows XP; I've no idea if Vista/7 have a new one).
I personally use it wrapped in a class, as seen here.
I think asking the user to save "individual" pages is weird, me think you should save all of them in one file (hey, but that just me).
If you need to save individual page, you will have to prompt the user with a small dialog that lists the pages and let the user select which page; or you can decide to save only the pages that were modified.
To select a folder, the simplest way is to use ShBrowseForFolder (http://msdn.microsoft.com/en-us/library/bb762115(v=vs.85).aspx)
Max.
Look into the OPENFILENAME structure and the GetSaveFileName function. The latter actually displays the save file dialog.

Resources