MOB Manual

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 3

M.O.B
A 3-level Production
Download.
https://github.com/3LP/M.O.B
What is M.O.B? M.O.B in it’s original
form is an IDE that combines both a com-
puter terminal and a source code editor in one
window. We made M.O.B to give scientists
with some programming skills, a basic GUI
that they can use as a foundation to make
their own apps.
M.O.B is written in Python because it can
be used to make many different applications,
and it is one of the easier programming lan-
guages to pick up in order to do computing
for science. M.O.B uses Gtk3+ because there
is great documentation for GUI design in
Python, with this API. Gtk3+ allows M.O.B
to be cross-platform between Mac and Linux
machines. For Mac users, we highly recom-
mend using homebrew and pypi to manage
M.O.B core dependencies.
Dependencies. Vte, Gtk3, GLib, Gdk,
GObject, Pango, PangoCairo, numpy, Gtk-
Source, GnomeCommon, Gnome-doc-util,
GnomeIconTheme, py2app.
Development. M.O.B could not
have been built without the guid-
ance provided by the Stack Ex-
change community. and this tutorial:
http://www.dreamincode.net/forums/topic/
150162-a-simple-text-editor-in-pythonpygtk/
The following link is a valuable re-
source when you are trying to incorpo-
rate your own app into M.O.B: https:
//python-gtk-3-tutorial.readthedocs.org/en/
latest/
Why M.O.B? Making apps in Python
is not difficult, however figuring out how to
make a GUI for the first time will be . First,
you want to figure out what platform you
want your app to run on. Next, you must re-
search APIs that will satisfy your need’s best.
Last, you have to write the code for your app.
There is a lot of unnecessary groundwork that
you must do, M.O.B is here so you don’t have
to start from scratch. M.O.B is provided with
a tutorial so that developers can have an un-
derstanding of it’s original structure. The tu-
torials are there to get you up to speed on the
layout of code for a GUI in Python, so that
you can customize M.O.B to meet your com-
putational desires.
Figure 1. M.O.B screenshot.
1
IDE M.O.B Tutorial
import os , sys
from g i . r e p o s i t o r y import Gtk , Vte , Pango , PangoCairo
from g i . r e p o s i t o r y import GLib , Gdk
from g i . r e p o s i t o r y import GObject
from g i . r e p o s i t o r y import GtkSource
Figure 2. Minimal dependencies for the M.O.B IDE. If you are interested in removing
these from M.O.B to replace with your own app, you will not need GtkSource.
Before the class MainWindow is defined, we need to declare any classes that you will
need to build your app. For the IDE M.O.B, below are the classes that we need.
Sta tu sBa r = Gtk . S ta tu sb ar ( )
s o u r c e = GtkSou rc e . View ( )
b u f f e r = so ur ce . g e t b u f f e r ( )
t e r m i n a l = Vte . Te rmin al ( )
t ex tv ie w = Gtk . TextView ( )
e ntr y = Gtk . Entry ( )
menu = Gtk . MenuBar ( )
f i l e m e n u = Gtk . Menu ( )
s cr ol le dw in do w1 = Gtk . ScrolledWindow ( )
vpaned = Gtk . VPaned ( )
g r i d = Gtk . Grid ( )
Figure 3. Declaring instances of required classes
We have set the class MainWindow to inherit functions from Gtk.Window. This class is
the foundation of the GUI. It contains the methods necessary to recreate classic GUI function-
ality; i.e. it creates a window with a menubar, that can perform basic Open/Save/SaveAs/Exit
functions.
c l a s s MainWindow( Gtk . Window ) :
f i l e t a g =
# Name o f F i l e f o r Open/Save/SaveAs Functions
de f o p e n f i l e ( menuitem , user param ) :
# Code s p e c i f i c to your a p p l i c a t i o n
de f s a v e f i l e ( menuitem , user param ) :
# Code s p e c i f i c to your a p p l i c a t i o n
de f s a v e f i l e a s ( menuitem , user param ) :
# Code s p e c i f i c to your a p p l i c a t i o n
d e f e n t r y g o ( s e l f , wi dg et ) :
# Automatic cod e g e n e r a t o r
# Convert Late x t o f o rm u la s i n t o Python and / o r C f o r l o o p s
de f i n i t ( s e l f ) :
Gtk . Window . i n i t ( s e l f )
# Window t i t l e and Ic on
2
s e l f . s e t t i t l e (M.O. B)
s e l f . co nn ect ( ” d e l e t e event , Gtk . ma i n qui t )
# IDE M.O. B s p e c i f i c code
#S t a r t i n g Window
window = MainWindow ( )
Gtk . main ( )
Figure 4. MainWindow Class.
Most of the code in figure 4 is missing, however this figure shows the basic structure for a
M.O.B app. See the source code on IDE M.O.B or your favorite IDE of choice. The original
M.O.B developer just wanted to write code in an app that combined a terminal and a source
editor, in ONE window.
We are currently making an executable icon for Mac, so to use M.O.B you have to open
it using the following terminal command.
python mob . py
3

Navigation menu