summary refs log tree commit diff stats
path: root/examples/plugin_hello_world.py
blob: b64916d4e53871e94d129167f022c602a36c5e6b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Compatible with ranger 1.6.0 through 1.7.*
#
# This is a sample plugin that displays "Hello World" in ranger's console after
# it started.

# We are going to extend the hook "ranger.api.hook_ready", so first we need
# to import ranger.api:
import ranger.api

# Save the previously existing hook, because maybe another module already
# extended that hook and we don't want to lose it:
old_hook_ready = ranger.api.hook_ready

# Create a replacement for the hook that...
def hook_ready(fm):
    # ...does the desired action...
    fm.notify("Hello World")
    # ...and calls the saved hook.  If you don't care about the return value,
    # simply return the return value of the previous hook to be safe.
    return old_hook_ready(fm)

# Finally, "monkey patch" the existing hook_ready function with our replacement:
ranger.api.hook_ready = hook_ready
243' href='#n243'>243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487
/* CSS seems backward: List all the classes for which we want a
   particular font, so that the font can be changed in one place.  (It
   would be nicer to reference a font definition from all the places
   that we want it.)

   As you read the rest of the file, remember to double-check here to
   see if any font is set. */

/* Monospace: */
.maincolumn, .refpara, .refelem, .tocset, .stt, .hspace, .refparaleft, .refelemleft {
  font-family: monospace;
}

/* Serif: */
.main, .refcontent, .tocview, .tocsub, i {
  font-family: serif;
}

/* Sans-serif: */
.version, .versionNoNav {
  font-family: sans-serif;
}

/* ---------------------------------------- */

p, .SIntrapara {
  display: block;
  margin: 1em 0;
}

h2 { /* per-page main title */
  margin-top: 0;
}

h3, h4, h5, h6, h7, h8 {
  margin-top: 1.75em;
  margin-bottom: 0.5em;
}

.SSubSubSubSection {
  font-weight: bold;
  font-size: 0.83em; /* should match h5; from HTML 4 reference */
}

/* Needed for browsers like Opera, and eventually for HTML 4 conformance.
   This means that multiple paragraphs in a table element do not have a space
   between them. */
table p {
  margin-top: 0;
  margin-bottom: 0;
}

/* ---------------------------------------- */
/* Main */

body {
  color: black;
  background-color: #ffffff;
}

table td {
  padding-left: 0;
  padding-right: 0;
}

.maincolumn {
  width: 43em;
  margin-right: -40em;
  margin-left: 15em;
}

.main {
  text-align: left;
}

/* ---------------------------------------- */
/* Navigation */

.navsettop, .navsetbottom {
  background-color: #f0f0e0;
  padding: 0.25em 0 0.25em 0;
}

.navsettop {
  margin-bottom: 1.5em;
  border-bottom: 2px solid #e0e0c0;
}

.navsetbottom {
  margin-top: 2em;
  border-top: 2px solid #e0e0c0;
}

.navleft {
  margin-left: 1ex;
  position: relative;
  float: left;
  white-space: nowrap;
}
.navright {
  margin-right: 1ex;
  position: relative;
  float: right;
  white-space: nowrap;
}
.nonavigation {
  color: #e0e0e0;
}

.searchform {
  display: inline;
  margin: 0;
  padding: 0;
}

.searchbox {
  width: 16em;
  margin: 0px;
  padding: 0px;
  background-color: #eee;
  border: 1px solid #ddd;
  text-align: center;
  vertical-align: middle;
}

#contextindicator {
  position: fixed;
  background-color: #c6f;
  color: #000;
  font-family: monospace;
  font-weight: bold;
  padding: 2px 10px;
  display: none;
  right: 0;
  bottom: 0;
}

/* ---------------------------------------- */
/* Version */

.versionbox {
  position: relative;
  float: right;
  left: 2em;
  height: 0em;
  width: 13em;
  margin: 0em -13em 0em 0em;
}
.version {
  font-size: small;
}
.versionNoNav {
  font-size: xx-small; /* avoid overlap with author */
}

.version:before, .versionNoNav:before {
  content: "Version ";
}

/* ---------------------------------------- */
/* Margin notes */

.refpara, .refelem {
  position: relative;
  float: right;
  left: 2em;
  height: 0em;
  width: 13em;
  margin: 0em -13em 0em 0em;
}

.refpara, .refparaleft {
  top: -1em;
}

.refcolumn {
  background-color: #F5F5DC;
  display: block;
  position: relative;
  width: 13em;
  font-size: 85%;
  border: 0.5em solid #F5F5DC;
  margin: 0 0 0 0;
}

.refcontent {
  margin: 0 0 0 0;
}

.refcontent p {
  margin-top: 0;
  margin-bottom: 0;
}

.refparaleft {
  position: relative;
  float: left;
  right: 2em;
  height: 0em;
  width: 13em;
  margin: 0em 0em 0em -13em;
}

.refcolumnleft, .refelemleft {
  background-color: #F5F5DC;
  display: block;
  position: relative;
  width: 13em;
  font-size: 85%;
  border: 0.5em solid #F5F5DC;
  margin: 0 0 0 0;
}


/* ---------------------------------------- */
/* Table of contents, inline */

.toclink {
  text-decoration: none;
  color: blue;
  font-size: 85%;
}

.toptoclink {
  text-decoration: none;
  color: blue;
  font-weight: bold;
}

/* ---------------------------------------- */
/* Table of contents, left margin */

.tocset {
  position: relative;
  float: left;
  width: 12.5em;
  margin-right: 2em;
}
.tocset td {
  vertical-align: text-top;
}

.tocview {
  text-align: left;
  background-color: #f0f0e0;
}

.tocsub {
  text-align: left;
  margin-top: 0.5em;
  background-color: #f0f0e0;
}

.tocviewlist, .tocsublist {
  margin-left: 0.2em;
  margin-right: 0.2em;
  padding-top: 0.2em;
  padding-bottom: 0.2em;
}
.tocviewlist table {
  font-size: 82%;
}

.tocviewsublist, .tocviewsublistonly, .tocviewsublisttop, .tocviewsublistbottom {
  margin-left: 0.4em;
  border-left: 1px solid #bbf;
  padding-left: 0.8em;
}
.tocviewsublist {
  margin-bottom: 1em;
}
.tocviewsublist table,
.tocviewsublistonly table,
.tocviewsublisttop table,
.tocviewsublistbottom table {
  font-size: 75%;
}

.tocviewtitle * {
  font-weight: bold;
}

.tocviewlink {
  text-decoration: none;
  color: blue;
}

.tocviewselflink {
  text-decoration: underline;
  color: blue;
}

.tocviewtoggle {
  text-decoration: none;
  color: blue;
  font-size: 75%; /* looks better, and avoids bounce when toggling sub-sections due to font alignments */
}

.tocsublist td {
  padding-left: 1em;
  text-indent: -1em;
}

.tocsublinknumber {
  font-size: 82%;
}

.tocsublink {
  font-size: 82%;
  text-decoration: none;
}

.tocsubseclink {
  font-size: 82%;
  text-decoration: none;
}

.tocsubnonseclink {
  font-size: 82%;
  text-decoration: none;
  padding-left: 0.5em;
}

.tocsubtitle {
  font-size: 82%;
  font-style: italic;
  margin: 0.2em;
}

.sepspace {
  font-size: 40%;
}

.septitle {
  font-size: 70%;
}

/* ---------------------------------------- */
/* Some inline styles */

.indexlink {
  text-decoration: none;
}

.nobreak {
  white-space: nowrap;
}

.stt {
}

.title {
  font-size: 200%;
  font-weight: normal;
  margin-top: 2.8em;
  text-align: center;
}

pre { margin-left: 2em; }
blockquote { margin-left: 2em; }

ol          { list-style-type: decimal; }
ol ol       { list-style-type: lower-alpha; }
ol ol ol    { list-style-type: lower-roman; }
ol ol ol ol { list-style-type: upper-alpha; }

i {
}

.SCodeFlow {
  display: block;
  margin-left: 1em;
  margin-bottom: 0em;
  margin-right: 1em;
  margin-top: 0em;
  white-space: nowrap;  
}

.SVInsetFlow {
  display: block;
  margin-left: 0em;
  margin-bottom: 0em;
  margin-right: 0em;
  margin-top: 0em;
}

.SubFlow {
  display: block;
  margin: 0em;
}

.boxed {
  width: 100%;
  background-color: #E8E8FF;
}

.hspace {
}

.slant {
  font-style: oblique;
}

.badlink {
  text-decoration: underline;
  color: red;
}

.plainlink {
  text-decoration: none;
  color: blue;
}

.techoutside       { text-decoration: underline; color: #b0b0b0; }
.techoutside:hover { text-decoration: underline; color: blue; }

/* .techinside:hover doesn't work with FF, .techinside:hover>
   .techinside doesn't work with IE, so use both (and IE doesn't
   work with inherit in the second one, so use blue directly) */
.techinside                    { color: black; }
.techinside:hover              { color: blue; }
.techoutside:hover>.techinside { color: inherit; }

.SCentered {
  text-align: center;
}

.imageleft {
  float: left;
  margin-right: 0.3em;
}

.Smaller{
  font-size: 82%;
}

.Larger{
  font-size: 122%;
}

/* A hack, inserted to break some Scheme ids: */
.mywbr {
  width: 0;
  font-size: 1px;
}

.compact li p {
  margin: 0em;
  padding: 0em;
}

.noborder img {
  border: 0;
}

.SAuthorListBox {
  position: relative;
  float: right;
  left: 2em;
  top: -2.5em;
  height: 0em;
  width: 13em;
  margin: 0em -13em 0em 0em;
}
.SAuthorList {
  font-size: 82%;
}
.SAuthorList:before {
  content: "by ";
}
.author {
  display: inline;
  white-space: nowrap;
}

/* print styles : hide the navigation elements */
@media print {
  .tocset,
  .navsettop,
  .navsetbottom { display: none; }
  .maincolumn {
    width: auto;
    margin-right: 13em;
    margin-left: 0;
  }
}