Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

215-Add-open-demo-in-world-menu #216

Merged
merged 2 commits into from
Jan 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/Material-Design-Lite-Core/MaterialDesignLite.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"
Description
--------------------

I am an empty class to manage infrastructure stuff
"
Class {
#name : #MaterialDesignLite,
#superclass : #Object,
#category : #'Material-Design-Lite-Core'
}

{ #category : #'world-menu' }
MaterialDesignLite class >> mainMenuCommandOn: aBuilder [
<worldMenu>
(aBuilder item: #MaterialDesignLite)
order: 20;
icon: (self mdlIcon scaledToSize: 16@16)
]

{ #category : #'as yet unclassified' }
MaterialDesignLite class >> mdlIcon [
^ PNGReadWriter formFromStream: MDLLibrary default logoPng readStream
]
34 changes: 33 additions & 1 deletion src/Material-Design-Lite-Demo/MDLDemo.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,41 @@ MDLDemo class >> initializeAs: aString [
yourself
]

{ #category : #'world menu' }
MDLDemo class >> menuCommandOn: aBuilder [
<worldMenu>
(aBuilder item: #'Open demo in default browser')
order: 2;
iconName: #nautilus;
parent: #MaterialDesignLite;
help: 'Open the demo in the default web browser';
action: [ self open ].
]

{ #category : #'instance creation' }
MDLDemo class >> open [
<script>
| port url |
WAServerManager default adaptors
ifEmpty: [ (ZnZincServerAdaptor port: (port := 8085)) start ]
ifNotEmpty: [ :adaptors |
adaptors
detect: #isRunning
ifFound: [ :anAdaptor | port := anAdaptor server port ]
ifNone: [ (ZnZincServerAdaptor port: (port := 8085)) start ] ].
url := 'http://localhost:' , port asString , '/MDLDemo'.
self flag: #pharo6.
SystemVersion current major < 7
ifTrue: [ self class environment
at: #OSProcess
ifPresent: [ :class | class command: 'open ' , url ]
ifAbsent: [ self inform: 'Open ' , url , ' or install OSProcess.' ] ]
ifFalse: [ WebBrowser openOn: url ]
]

{ #category : #versions }
MDLDemo class >> version [
^ 'development (from v1.3.2)'
^ 'development (from v1.3.3)'
]

{ #category : #hooks }
Expand Down
Loading