def rst_one_link(self, link, name=None): if name is None: junk, name = os.path.split(link) if not rwkos.amiLinux(): link = link.replace('\\','/') #curline = self.level*ws+'- `%s <%s>`_'% (name, link) curline = '- `%s <%s>`_'% (name, link) return curline
def rst_toplinks(self): listout = [] for link in self.toplinks: junk, nameonly = os.path.split(link) if not rwkos.amiLinux(): link = link.replace('\\','/') curline = self.level*ws+'- `%s <%s>`_'% (nameonly, link) listout.append(curline) return listout
def to_pdf(self): if not self.saved: self.save() if not rwkos.amiLinux(): base_cmd = 'rst2html.py %s %s' else: base_cmd = 'rst2latex_rwk.py %s %s' cmd = base_cmd % (self.pathin, self.htmlpath) print(cmd) os.system(cmd)
def openemacs(pathin): if not pathin: return if os.path.exists(pathin): if rwkos.amiLinux(): cmd='emacs '+pathin+' &' os.system(cmd) else: cmd='emacsclientw '+pathin subprocess.Popen(cmd) print cmd
def rst2html_fullpath(pathin, add_up_link=False, \ uplink_path=None): if add_up_link: add_up_link_to_rst(pathin, uplink_path=uplink_path) pne, ext = os.path.splitext(pathin) htmlpath = pne + '.html' if not rwkos.amiLinux(): base_cmd = 'rst2html.py %s %s' else: base_cmd = 'rst2html %s %s' cmd = base_cmd % (pathin, htmlpath) os.system(cmd)
def OpenOutput(outputpath, dvi=None, debug=1, kpdf=False): if dvi is None: pne, ext = os.path.splitext(outputpath) elif dvi: ext = ".dvi" else: ext = ".pdf" if rwkos.amiLinux(): cmds = {".dvi": "kdvi %s", ".pdf": "acroread %s"} if kpdf: cmds[".pdf"] = "kpdf %s" else: cmds = {".dvi": "yap -1 %s", ".pdf": "AcroRd32 %s"} mycmd = cmds[ext] % outputpath if debug > 0: rwkmisc.PrintToScreen(["mycmd"], locals()) if rwkos.amiLinux(): os.system(mycmd + " &") else: subprocess.Popen(mycmd)
def OpenOutput(outputpath, dvi=None, debug=1, kpdf=False): if dvi is None: pne, ext = os.path.splitext(outputpath) elif dvi: ext = '.dvi' else: ext = '.pdf' if rwkos.amiLinux(): cmds={'.dvi':'kdvi %s','.pdf':'acroread %s'} if kpdf: cmds['.pdf'] = 'kpdf %s' else: cmds={'.dvi':'yap -1 %s','.pdf':'AcroRd32 %s'} mycmd=cmds[ext]% outputpath if debug > 0: rwkmisc.PrintToScreen(['mycmd'],locals()) if rwkos.amiLinux(): os.system(mycmd + ' &') else: subprocess.Popen(mycmd)
def Launch_PDF(self, event=0): self.Build_PDF_Path() path = rwkos.FindFullPath(self.pdfpath) if rwkos.amiLinux(): pdfcmd = 'kpdf %s &' cmd = pdfcmd % path print(cmd) os.system(cmd) else: pdfcmd = 'AcroRd32.exe %s' cmd = pdfcmd % path print(cmd) subprocess.Popen(cmd)
def OpenOutput(self, evt): kpdf = self.OptionsPanel.kpdf.GetValue() if rwkos.amiLinux(): if kpdf: cmds={'.dvi':'kdvi %s','.pdf':'kpdf %s'} else: cmds={'.dvi':'kdvi %s','.pdf':'acroread %s'} else: cmds={'.dvi':'yap -1 %s','.pdf':'AcroRd32 %s'} outname = self.GetOutputPath() print 'outname='+str(outname) if not outname: print "No outname, exitting." return outpath_noext, ext = os.path.splitext(outname) mycmd=cmds[ext]% outname # print('mycmd='+mycmd) # subprocess.Popen(cmds[ext]% outname) if rwkos.amiLinux(): os.system(mycmd + ' &') print('mycmd='+mycmd) else: subprocess.Popen(mycmd)
def rst_to_html(self): if not hasattr(self, 'rst_path'): self.save_rst() curdir = os.getcwd() print('curdir='+curdir) if rwkos.amiLinux(): basecmd = 'rst2html' else: basecmd = 'python C:\\Python25\\Scripts\\rst2html.py' cmd = basecmd+' %s %s' % (self.rst_name, self.index_name) print(cmd) if self.main_dir: print('switching to '+self.main_dir) os.chdir(self.main_dir) os.system(cmd) if curdir: print('switching back to '+curdir) os.chdir(curdir)
def rst2html(self): my_dir = self.get_main_dir() fno, ext = os.path.splitext(self.index_name) rst_name = fno+'.rst' rst_path = os.path.join(my_dir, rst_name) html_path = os.path.join(my_dir, self.index_name) if os.path.exists(rst_path): curdir = os.getcwd() print('curdir='+curdir) try: if rwkos.amiLinux(): basecmd = 'rst2html' else: basecmd = 'python C:\\Python25\\Scripts\\rst2html.py' cmd = basecmd+' %s %s' % (rst_name, self.index_name) #print(cmd) print('switching to '+my_dir) os.chdir(my_dir) os.system(cmd) finally: print('switching back to '+curdir) os.chdir(curdir)
#!/usr/bin/python import os, glob, re, socket import time import math from gimpfu import * import rwkos import pdb as Pdb import vibrations_gimp from gimp_copy_utils import * Linux = rwkos.amiLinux() ##graph_path = '/home/ryan/siue/classes/graph_paper.png' ## classes_base = '/home/ryan/siue/classes' ## keys = ['452','mechatronics','482','484','356','mobile_robotics'] ## nums = ['452','458','482','484','356','492'] ## course_num_dict = dict(zip(keys, nums)) ## bases = ['452/lectures', 'mechatronics/2009/lectures', '482/2009/lectures', \ ## '484/lectures', '356/Fall_2009/lectures', \ ## 'mobile_robotics/2009/lectures'] ## base_dict = dict(zip(keys, bases)) ## curdir = os.getcwd() ## log_msg('curdir = %s' % curdir) import pygimp_lecture_utils
import glob, os, pdb, socket, shutil, datetime, time, numpy import rwkmisc, listbox, thumbnail_viewer, image_on_scrolled_window settings_path = 'settings_photo_app.pkl' import rwkos, photo_db myname = socket.gethostname() month_list = [photo_db.month_map[ind] for ind in range(1,13)] import copy if myname == 'AM2': if rwkos.amiLinux(): myroot = '/mnt/personal/pictures/Joshua_Ryan' elif myname == 'hpdv4': myroot = '/home/ryan/JoshuaRyan_on_AM2' if not os.path.exists(myroot): print('You have not mounted the AM2 pictures folder.') print('please run the script ~/scripts/mount_Joshua_pics') myroot = None # Database columns: # # - filename # - relpath<-- use rel rather than full # - folder # - year
import os, rwkos, rwkpickle, re, time import pdb as Pdb from gimpfu import * Linux = rwkos.amiLinux() import tkFileDialog autosave_dir = 'gimpautosave' home = rwkos.get_home() lecturerc_name = 'pygimp_lecturerc.pkl' lecturerc_path = os.path.join(home, lecturerc_name) log_path = os.path.join(home, 'pygimp_log.txt') graph_path = '/home/ryan/siue/classes/graph_paper_2000_by_1300.png' graph_path = rwkos.FindFullPath(graph_path) classes_base = '/home/ryan/siue/classes' classes_base = rwkos.FindFullPath(classes_base) keys = ['452', 'mechatronics', '482', '484', '356', 'mobile_robotics', '450'] nums = ['452', '458', '482', '484', '356', '492', '450'] course_num_dict = dict(zip(keys, nums)) bases = ['452/lectures', 'mechatronics/2009/lectures', '482/2009/lectures', \ '484/lectures', '356/Fall_2009/lectures', \ 'mobile_robotics/2010/lectures'] if not Linux: bases = [item.replace('/', '\\') for item in bases]