Display File Dialog from Device Adapter

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Display File Dialog from Device Adapter

lashford
Nico,
      What is the correct method to display a save/save-as file dialog from my device adapter that will allow the user to select a file path to load or save data specific to my adapter? Are there any restrictions that might prohibit me doing this from my adapter code? I would also extend this question to any interactive dialog that I might wish to display from my adapter. Is there any reason that I can or should not do this?
       Thanks,
       Louis
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Display File Dialog from Device Adapter

Nico Stuurman
Administrator
Hi Louis,

>      What is the correct method to display a save/save-as file dialog from
> my device adapter that will allow the user to select a file path to load or
> save data specific to my adapter? Are there any restrictions that might
> prohibit me doing this from my adapter code? I would also extend this
> question to any interactive dialog that I might wish to display from my
> adapter. Is there any reason that I can or should not do this?

Technically, it is definitely possible to show a dialog box originating from your device adapter.  However, this strategy does not conform to the design principles of Micro-Manager and will lead to strange behavior in the UI (UI elements from Java Swing will mix with UI elements coming from C++ code) as well as make your device adapter code platform specific.  The software design aims to separate device control from UI completely, and there are therefore no UI elements in the Core or device adapters.  

The desired way to provide things like a path to preferences or a dialog to interactively set properties is to write a plugin (in Java: http://valelab.ucsf.edu/~MM/MMwiki/index.php/Writing_plugins_for_Micro-Manager ) that interacts specifically with your device.  An example is the ASI CRISP plugin included in the latest nightly builds of Micro-Manager.  

B.t.w., you will need to be able to expose all capabilities of your device as properties to implement this strategy.  When you expose them as properties, then the user can already create a configuration group with those properties and use it to store preferences.  

It may help if you could give some more specific examples of what you try to accomplish so that we can provide more specific guidance.

Best,

Nico


------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create
new or port existing apps to sell to consumers worldwide. Explore the
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Display File Dialog from Device Adapter

lashford
Nico,
       I understand the strategic reason as you say for not presenting a dialog in this manner. To give you a little more info about what I am doing; (this is pre-release for this product so i will be somewhat general)
       I have an array of data that the user can load from a file and then on demand send to my device. This array of data defines how the device will behave on each camera trigger. I wanted to allow the user to select and download a different data file at any time to modify the function of my device. I would have been simple to present a file dialog for that purpose.  I have however found a work around for this. I have defined a file name property for the adapter the user can modify... (not a path) I then build a path to the users Appdata\Local\company\product directory and require that the file be in this location. (I realize this may not be portable across other non-windows platforms) I then have a load property that causes the file to be loaded and another to send the file to my hardware. This works fine and is more consistent with your general strategy I think. All these properties are defined consistent with your Adapter guidelines and available to the user. Is there any problem with me doing this this way?

      Thanks,
       Louis
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Display File Dialog from Device Adapter

Karl Bellve-3


On Wed, Jan 11, 2012 at 7:52 AM, lashford <[hidden email]> wrote:
Nico,
<snip> 
  I have an array of data that the user can load from a file and then
on demand send to my device. This array of data defines how the device will
behave on each camera trigger. I wanted to allow the user to select and
download a different data file at any time to modify the function of my
device. I would have been simple to present a file dialog for that purpose.
I have however found a work around for this. I have defined a file name
property for the adapter the user can modify...

Louis,

This is what I do for my ITC18 adapter. The code is in the repository. I use external files, but I have a property that users can modify to specify any number of files. I call them imaging protocol files but they define TTL and voltages. The device adapter then loads those files and creates a buffer to send the data to the ITC18.


 
--
Cheers,

Karl Bellvé
Biomedical Imaging Group
University of Massachusetts Medical School

------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Display File Dialog from Device Adapter

Johan Henriksson-2
I have made a device like this too, locally. I would like to propose adding a new type of values, "file path", so that the GUI can recognize this and provide a file dialog

/Johan


On Wed, Jan 11, 2012 at 2:59 PM, Karl Bellve <[hidden email]> wrote:


On Wed, Jan 11, 2012 at 7:52 AM, lashford <[hidden email]> wrote:
Nico,
<snip> 
  I have an array of data that the user can load from a file and then
on demand send to my device. This array of data defines how the device will
behave on each camera trigger. I wanted to allow the user to select and
download a different data file at any time to modify the function of my
device. I would have been simple to present a file dialog for that purpose.
I have however found a work around for this. I have defined a file name
property for the adapter the user can modify...

Louis,

This is what I do for my ITC18 adapter. The code is in the repository. I use external files, but I have a property that users can modify to specify any number of files. I call them imaging protocol files but they define TTL and voltages. The device adapter then loads those files and creates a buffer to send the data to the ITC18.


 
--
Cheers,

Karl Bellvé
Biomedical Imaging Group
University of Massachusetts Medical School

------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general




--
-----------------------------------------------------------
Johan Henriksson
PhD student, Karolinska Institutet
http://mahogny.areta.org  http://www.endrov.net

------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Display File Dialog from Device Adapter

Karl Bellve-3


On Wed, Jan 11, 2012 at 9:44 AM, Johan Henriksson <[hidden email]> wrote:
I have made a device like this too, locally. I would like to propose adding a new type of values, "file path", so that the GUI can recognize this and provide a file dialog

/Johan



Excellent idea.
 
--
Cheers,

Karl Bellvé
Biomedical Imaging Group
University of Massachusetts Medical School


------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Loading...