CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Tue Aug 20, 2019 6:45 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Thu Jul 24, 2014 8:36 pm 
Offline

Joined: Tue Apr 13, 2010 1:59 pm
Posts: 21
Hello,

Is it possible that the path attribute of this method has no effect?
In the code:
Code:
filepath = system.ui.browse_directory_dialog("Select a directory", path=projectPath)

Where projectPath is a valid string:
Code:
C:\Users\francois\Documents\Software\Codesys\project

The prompt has "My computer" selected.

Thanks!


Top
   
PostPosted: Fri Jul 25, 2014 8:24 am 
Offline
Frequent User
Frequent User
User avatar

Joined: Fri Mar 18, 2011 4:12 pm
Posts: 266
Hello,

I did test it with several pathes (on local harddisk and on a network drive) and it worked.

It did not work, however, when trying an UNC path ("\\servername\share\some\directory") or a path to a directory which does not exist, in both cases, it did show "My Computer".

Does your project path directory actually exist?

Internally, we're just using the .NET Framework FolderBrowserDialog, so the (a little bit weird) rules for its "SelectedPath" property also apply to the "path" parameter of our browse_directory_dialog function.

One of the Rules is:
Quote:
[...]as long as SelectedPath is an absolute path that is a subfolder of RootFolder (or more accurately, points to a subfolder of the shell namespace represented by RootFolder)


The default parameter for the root_folder is Environment.SpecialFolder.MyComputer, you may have better results with passing different values for this parameter:

Code:
from __future__ import print_function

import System
   
res = system.ui.browse_directory_dialog("Choose a directory", path="\\\\server01\\SomeShare\\some\\path", root_folder=System.Environment.SpecialFolder.Desktop)

print("The user did choose: '%s'" % res)


This value seemed to work also for network shares, but still not for non-existing pathes.

_________________
Check out the CODESYS store: http://store.codesys.com/

CODESYS® a trademark of 3S-Smart Software Solutions GmbH
Inspiring Automation Solutions


Top
   
PostPosted: Fri Jul 25, 2014 11:54 am 
Offline

Joined: Tue Apr 13, 2010 1:59 pm
Posts: 21
Thanks for your answer!

Specifying the Desktop folder instead of MyComputer worked perfectly.

Regards


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 3 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited