JVc@s"dZdZdZdZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl m Z mZddlTddlTddlmZmZmZmZmZmZmZdd lmZdd lmZydd lmZmZmZddl Zdd l!m"Z"ery,dd l#m$Z$m%Z%m&Z&m'Z'm(Z(Wqdd l)m$Z$m%Z%m&Z&m'Z'm(Z(qXn(dd l*m$Z$m%Z%m&Z&m'Z'm(Z(e+Z,Wn1e-k re.j/de0Z,ej1dnXddl2Z2e2j3de4dZ5d&\a7a8da9da:d'\a;a<a=iZ>de?fdYZ@dejAjBfdYZCdZDdZEdZFdZGdZHdZIdZJddZKdZLddZMd ZNdd!ZOd"ZPd#ZQd$ZRdddd%ZSdS((s12.0s9Services and Status System Tray dBus Child/Parent ProcessthpssdsProvides persistent data and event services to HPLIP client applications. Required to be running for PC send fax, optional in all other cases.iN(tloadstHIGHEST_PROTOCOL(t*(tutilstdevicetstatustmodelstmoduletservicestos_utils(tPY3(t to_bytes_utf8(tlowlevelt SystemBust SessionBus(t DBusGMainLoop(tMainLoopt timeout_addt threads_initt io_add_watchtIO_INsAdbus failed to load (python-dbus ver. 0.80+ required). Exiting...itignoreit DeviceCachecBseZddZRS(tcCsatjtj|_tj||_i|_i|_ i|_ d|_ d|_ t |_dS(Ni(Rt RingBuffertpropt history_sizethistoryRtnormalizeModelNametmodeltcachetfaxestdqtbackoff_countertbackoff_countdowntFalsetpolling(tselfR((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/hpssd.pyt__init__Xs     (t__name__t __module__R'(((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/hpssd.pyRWst StatusServicecBsUeZdZejjddddddZejjddddddZejjddd dd d Zejjddd dd d Z ejjddddddZ ejjddd dddZ ejjddd ddddZ dZ ejjddddddZRS(cCstjjj|||dS(N(tdbustservicetObjectR'(R&tnamet object_path((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/hpssd.pyR'fsscom.hplip.StatusServicet in_signaturetst out_signatures sa(ssisisd)cCstjd|ty t|Wntk r>|gfSXt|jj}tjdt|g|D]}|j^qp|g|D]}|j^qfSdS(NsGetHistory('%s')s%d events in history:( tlogtdebugtsend_systray_bliptdevicestKeyErrorRtgettlentas_tuple(R&t device_urithtx((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/hpssd.pyt GetHistoryjs   ssa{ss}cCstjd|ty t|Wntk r>|ifSXi}t|j}gt|jD]"}|j|t ||^qetj|||fSdS(NsGetStatus('%s')( R3R4R5R6R7R!tlisttkeyst setdefaulttstr(R&R;ttR!R=((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/hpssd.pyt GetStatuszs    9 tssiticCsEtjd|||ft|tkrA|t|j|<|SdS(Ns!SetCachedIntValue('%s', '%s', %d)i(R3R4t check_devicet ERROR_SUCCESSR6R(R&R;tkeytvalue((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/hpssd.pytSetCachedIntValues tsscCsMyt|j|}Wntk r.d}nXtjd|||f|S(Nis$GetCachedIntValue('%s', '%s') --> %d(R6RR7R3R4(R&R;RItret((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/hpssd.pytGetCachedIntValues   tssscCsEtjd|||ft|tkrA|t|j|<|SdS(Ns#SetCachedStrValue('%s', '%s', '%s')R(R3R4RGRHR6R(R&R;RIRJ((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/hpssd.pytSetCachedStrValues cCsMyt|j|}Wntk r.d}nXtjd|||f|S(NRs$GetCachedStrValue('%s', '%s') --> %s(R6RR7R3R4(R&R;RIRM((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/hpssd.pytGetCachedStrValues   tssisisdsicCstjd|||ft|dd||dddf}t|t||ryt|j||fWntk r|SX|j|||SnMxFt t|jj D]+\}}||kr|j|||SqW|SdS(Ns"CheckForWaitingFax('%s', '%s', %d)Rig( R3R4R5RGtshow_waiting_faxesR6R R7tcheck_for_waiting_fax_returnR?R@(R&R;tusernametjob_idtrtutj((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/hpssd.pytCheckForWaitingFaxs   & cCsVtjd||ft|j||fj}t|j||f=t||S(NsFFax (username=%s, jobid=%d) removed from faxes and returned to caller.(R3R4R6R R:RS(R&tdRXRYRW((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/hpssd.pyRTs  tssisisRcCs,tj||||||}t|dS(N(RtEventt handle_event(R&R;t printer_namet event_codeRURVttitletevent((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/hpssd.pyt SendEvents(R(R)R'R+R,tmethodR>RDRKRNRPRQRZRTRc(((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/hpssd.pyR*es ''' ' ' '  c Cstst|}ny t|Wntk rtjd|y.tj|\ }}}}}}}}} Wn#tk rtjd|t SXt |t|RxRRRR3R4tNoneR`tEVENT_AUTO_CONFIGURERtEVENT_DIAGNOSE_PRINTQUEUERR;RGRHtEVENT_MAX_EVENTRtMapPJLErrorCodetEVENT_MIN_USER_EVENTtEVENT_MAX_USER_EVENTRstEVENT_DEVICE_STOP_POLLINGtEVENT_START_MAINT_JOBtEVENT_START_COPY_JOBtEVENT_START_FAX_JOBtEVENT_START_PRINT_JOBtEVENT_DEVICE_START_POLLINGtEVENT_END_MAINT_JOBtEVENT_END_COPY_JOBtEVENT_END_FAX_JOBtEVENT_END_PRINT_JOBt!EVENT_PRINT_FAILED_MISSING_PLUGINtEVENT_SCANNER_FAILtEVENT_END_SCAN_JOBt EVENT_SCAN_FAILED_MISSING_PLUGINtEVENT_FAX_JOB_FAILtEVENT_FAX_JOB_CANCELEDtEVENT_FAX_FAILED_MISSING_PLUGINtEVENT_COPY_JOB_FAILtEVENT_COPY_JOB_CANCELEDtsend_event_to_systray_uiRtEVENT_HISTORY_UPDATEt EVENT_FAX_MINt EVENT_FAX_MAXRBRt EVENT_USER_CONFIGURATION_CHANGEDtEVENT_SYS_CONFIGURATION_CHANGEDtEVENT_DEVICE_UPDATE_REQUESTEDtsend_event_to_hpdiotEVENT_DEVICE_UPDATE_ACTIVEtEVENT_DEVICE_UPDATE_INACTIVERtintRtEVENT_CUPS_QUEUES_ADDEDtEVENT_CUPS_QUEUES_REMOVEDtEVENT_SYSTEMTRAY_EXITt main_looptquitR(Rbt more_argst dup_eventRR((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/hpssd.pyR^s              %               cCsttjddtdS(NR(RRR]tEVENT_DEVICE_UPDATE_BLIP(((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/hpssd.pyR5 scCs8|j}|dk r$||_n|jtddS(Nt systemtray(RRR`t send_via_pipetw1(RbR`R((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/hpssd.pyRs   cCs|jtddS(Nthpdio(Rtw2(Rb((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/hpssd.pyRscCs8|j}|dk r$||_n|jtddS(Nscom.hplip.Toolbox(RRR`t send_via_dbust session_bus(RbR`R((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/hpssd.pyRs   cOsH|ddkrD|ddkrDtj|d }t||dSdS(Nt interfacescom.hplip.StatusServicetmemberR]i(RR]R^(ttyptargstkwdsRb((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/hpssd.pyt handle_signal(scOstd||S(Ntsystem(R(RR((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/hpssd.pythandle_system_signal0scOstd||S(Ntsession(R(RR((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/hpssd.pythandle_session_signal4sc Cstjdtjdtj|||aaatdt a t a yt dt aWn3tjjk r}tjdtjdnXytjaWnbtjjk r }tjdkrtjdtjdqtjd tjdnXtjtd d d d ddddddtjtd d d d ddddddtjjdt}t|d}tjdyt jWntk rtjdnXdS(Nshp-systray(hpssd)sPID=%dtset_as_defaulttmainloops.Unable to connect to dbus system bus. Exiting.iis/Unable to connect to dbus session bus. Exiting.s8Unable to connect to dbus session bus (running as root?)tsender_keywordtsendertdestination_keywordtdesttinterface_keywordRtmember_keywordRt path_keywordRscom.hplip.StatusServices/com/hplip/StatusServicesEntering main dbus loop...sCtrl-C: Exiting...( R3t set_moduleR4RxRRRRRRqt dbus_loopRRRt system_busR+t exceptionst DBusExceptionRtsystexitRRtgetuidtadd_signal_receiverRRR,tBusNameR*truntKeyboardInterrupt(t write_pipe1t write_pipe2t read_pipe3Rt session_nametstatus_service((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/hpssd.pyR9s>           (NN(NNN(Tt __version__t __title__t__mod__t__doc__RtstructRxttimetgetoptRRRvtpickleRRtbase.gt base.codestbaseRRRRRR R t base.sixextR R R+R RRt dbus.servicetdbus.mainloop.glibRt gi._gobjectRRRRRtgi.repository.GLibtgobjectRqt dbus_loadedt ImportErrorR3RR$Rtwarningst simplefiltertDeprecationWarningR|RRRRRRRRR6tobjectRR,R-R*RGRsRRSRRRR^R5RRRRRRR(((sU/builds/ul11u3sru-gate/components/hplip/build/prototype/i386/usr/share/hplip/hpssd.pytsx          4 ,/(      {  :