| ... | ... |
@@ -1964,7 +1964,7 @@ class DotWindow(Gtk.Window): |
| 1964 | 1964 |
|
| 1965 | 1965 |
base_title = 'Dot Viewer' |
| 1966 | 1966 |
|
| 1967 |
- def __init__(self, widget=None): |
|
| 1967 |
+ def __init__(self, widget=None, width=512, height=512): |
|
| 1968 | 1968 |
Gtk.Window.__init__(self) |
| 1969 | 1969 |
|
| 1970 | 1970 |
self.graph = Graph() |
| ... | ... |
@@ -1972,7 +1972,7 @@ class DotWindow(Gtk.Window): |
| 1972 | 1972 |
window = self |
| 1973 | 1973 |
|
| 1974 | 1974 |
window.set_title(self.base_title) |
| 1975 |
- window.set_default_size(512, 512) |
|
| 1975 |
+ window.set_default_size(width, height) |
|
| 1976 | 1976 |
vbox = Gtk.VBox() |
| 1977 | 1977 |
window.add(vbox) |
| 1978 | 1978 |
|
| ... | ... |
@@ -2165,12 +2165,23 @@ Shortcuts: |
| 2165 | 2165 |
'-n', '--no-filter', |
| 2166 | 2166 |
action='store_const', const=None, dest='filter', |
| 2167 | 2167 |
help='assume input is already filtered into xdot format (use e.g. dot -Txdot)') |
| 2168 |
+ parser.add_option( |
|
| 2169 |
+ '-g', None, |
|
| 2170 |
+ action='store', dest='geometry', |
|
| 2171 |
+ help='default window size in form WxH') |
|
| 2168 | 2172 |
|
| 2169 | 2173 |
(options, args) = parser.parse_args(sys.argv[1:]) |
| 2170 | 2174 |
if len(args) > 1: |
| 2171 | 2175 |
parser.error('incorrect number of arguments')
|
| 2172 | 2176 |
|
| 2173 |
- win = DotWindow() |
|
| 2177 |
+ width = height = 512 |
|
| 2178 |
+ if options.geometry: |
|
| 2179 |
+ try: |
|
| 2180 |
+ width,height = (int(i) for i in options.geometry.split('x'))
|
|
| 2181 |
+ except ValueError: |
|
| 2182 |
+ parser.error('invalid window geometry')
|
|
| 2183 |
+ |
|
| 2184 |
+ win = DotWindow(width=width, height=height) |
|
| 2174 | 2185 |
win.connect('delete-event', Gtk.main_quit)
|
| 2175 | 2186 |
win.set_filter(options.filter) |
| 2176 | 2187 |
if len(args) >= 1: |