Skip to content

Commit

Permalink
Made Quantomatic accept commandline arguments (See #202).
Browse files Browse the repository at this point in the history
The first argument, if given, should point to a project file to be opened.
The second argument, if given, should point to a qgraph/qrule/etc file to be opened.

Used to interact with github.com/Quantomatic/pyzx
  • Loading branch information
John van de Wetering committed Aug 28, 2018
1 parent 7eb48e4 commit 9d3c366
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions scala/src/main/scala/quanto/gui/QuantoDerive.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,27 @@ import java.lang.NullPointerException
import javax.imageio.ImageIO
import javax.swing.filechooser.FileNameExtensionFilter
import quanto.gui.QuantoDerive.FileMenu.mnemonic
import quanto.gui.FileOpened
import quanto.util._


class NoProjectException extends Exception("No project open.")

object QuantoDerive extends SimpleSwingApplication {
override def main(args: Array[String]): Unit = {
super.main(args)
if (args.length > 0) {
alert("Loading project from commandline")
val arg = args(0)
loadProject(arg)
}
if (args.length > 1) {
alert("Opening file from commandline")
val fname = args(1)
ProjectFileTree.publish(FileOpened(new File(fname)))
}
}

System.setProperty("apple.eawt.quitStrategy", "CLOSE_ALL_WINDOWS")
val CommandMask = java.awt.Toolkit.getDefaultToolkit.getMenuShortcutKeyMask
val actorSystem = ActorSystem("QuantoDerive")
Expand Down

0 comments on commit 9d3c366

Please sign in to comment.