BFjfddlTGddeZGddeZGddeZGdd eZGd d eZd S) )*cbeZdZdZdZdZdZdZGddeZ Gdd eZ d S) EdgeOptionsz This is where the construction of the edges' options takes place. So far, the edge smoothness can be switched through this object as well as the edge color's inheritance. cj||_||_dSN)SmoothsmoothColorcolorselfs ;C:\PYTHON\_runtimes\venv\Lib\site-packages\pyvis/options.py__init__zEdgeOptions.__init__ s$kkmm ZZ\\ c||j_dS)ac Whether or not to inherit colors from the source node. If this is set to `from` then the edge will take the color of the source node. If it is set to `to` then the color will be that of the destination node. .. note:: If set to `True` then the `from` behavior is adopted and vice versa. N)r inheritr statuss rinherit_colorszEdgeOptions.inherit_colorss$ rc||j_dS)a Change smooth option for edges. When using dynamic, the edges will have an invisible support node guiding the shape. This node is part of the physics simulation, :param smooth_type: Possible options are dynamic, continuous, discrete, diagonalCross, straightCross, horizontal, vertical, curvedCW, curvedCCW, cubicBezier :type smooth_type: str N)r type)r smooth_types rtoggle_smoothnesszEdgeOptions.toggle_smoothnesss' rc*t|jSrstr__dict__r s r__repr__zEdgeOptions.__repr__(4=!!!rceZdZdZdZdZdS)EdgeOptions.Smootha When the edges are made to be smooth, the edges are drawn as a dynamic quadratic bezier curve. The drawing of these curves takes longer than that of the straight curves but it looks better. There is a difference between dynamic smooth curves and static smooth curves. The dynamic smooth curves have an invisible support node that takes part in the physics simulation. If there are a lot of edges, another kind of smooth than dynamic would be better for performance. c*t|jSrrr s rrzEdgeOptions.Smooth.__repr__6t}%% %rc"d|_d|_dS)NTdynamic)enabledrr s rrzEdgeOptions.Smooth.__init__9sDL!DIIIrN__name__ __module__ __qualname____doc__rrrrrr!+s<  & & & " " " " "rrceZdZdZdZdZdS)EdgeOptions.Colorz The color object contains the color information of the edge in every situation. When the edge only needs a single color value like 'rgb(120,32,14)', '#ffffff' or 'red' can be supplied instead of an object. c*t|jSrrr s rrzEdgeOptions.Color.__repr__Dr#rcd|_dSNT)rr s rrzEdgeOptions.Color.__init__Gs DLLLrNr'r,rrr r.=s<   & & &     rr N) r(r)r*r+rrrrobjectrr r,rrrrs """ $ $ $ ' ' '"""""""""""$            rrc$eZdZdZdZdZdZdS) Interactionz Used for all user interaction with the network. Handles mouse and touch events as well as the navigation buttons and the popups. c*t|jSrrr s rrzInteraction.__repr__Prrc0d|_d|_d|_dS)NFT)hideEdgesOnDraghideNodesOnDrag dragNodesr s rrzInteraction.__init__Ss$$rc|j|Srrr items r __getitem__zInteraction.__getitem__X}T""rNr(r)r*r+rrr>r,rrr4r4KsK""" #####rr4c&eZdZdZdZddZdZdS) Configurezl Handles the HTML part of the canvas and generates an interactive option editor with filtering. c*t|jSrrr s rrzConfigure.__repr__brrFNc*||_|r ||_dSdSr)r&filter)r r&filter_s rrzConfigure.__init__es&  "!DKKK " "rc|j|Srr;r<s rr>zConfigure.__getitem__jr?r)FNr@r,rrrBrB\sP """"""" #####rrBcNeZdZdZdZd dZdZdZdZGd d e Z dS) Layoutzd Acts as the camera that looks on the canvas. Does the animation, zooming and focusing. c*t|jSrrr s rrzLayout.__repr__trrNTcl|sd|_n||_||_|d|_dS)NT)r&) randomSeedimprovedLayout Hierarchical hierarchical)r rMrNs rrzLayout.__init__wsA )DOO(DO, --d-;;rc||j_dS)z< The distance between the different levels. N)rPlevelSeparationr distances rset_separationzLayout.set_separations-5)))rc||j_dS)z Distance between different trees (independent networks). This is only for the initial layout. If you enable physics, the repulsion model will denote the distance between the trees. N)rP treeSpacingrSs rset_tree_spacingzLayout.set_tree_spacings )1%%%rc||j_dS)a Method for reducing whitespace. Can be used alone or together with block shifting. Enabling block shifting will usually speed up the layout process. Each node will try to move along its free axis to reduce the total length of it's edges. This is mainly for the initial layout. If you enable physics, they layout will be determined by the physics. This will greatly speed up the stabilization time N)rPedgeMinimizationrs rset_edge_minimizationzLayout.set_edge_minimizations.4***rc*eZdZdZ d dZdS) Layout.Hierarchicalc|j|Srr;r<s rr>zLayout.Hierarchical.__getitem__s=& &rFThubsizech||_||_||_||_||_||_||_dSr)r&rRrW blockShiftingrZparentCentralization sortMethod)r r&rRrWrcrZrdres rrzLayout.Hierarchical.__init__s>#DL#2D *D !.D $4D !(rr,rrrOr]sN ' ' '"$' #"&%))-( ) ) ) ) ) )rrOr1) r(r)r*r+rrrUrXr[r2rOr,rrrIrIns """<<<<555 111 4 4 4)))))v)))))rrIc2eZdZdZdZdZddZdZdZdS) Optionsa Represents the global options of the network. This object consists of indiviual sub-objects that map to VisJS's modules of: - configure - layout - interaction - physics - edges The JSON representation of this object is directly passed in to the VisJS framework. In the future this can be expanded to completely mimic the structure VisJS can expect. c*t|jSrrr s rrzOptions.__repr__rrc|j|Srr;r<s rr>zOptions.__getitem__r?rNc|rt|_t|_t |_t |_t|_ dSr) rIlayoutr4 interactionrB configurePhysicsphysicsredges)r rks rrzOptions.__init__sF  # ((DK&=="yy  ]] rc|dddd}|d}||d}t|}|S)aG This method should accept a JSON string and replace its internal options structure with the given argument after parsing it. In practice, this method should be called after using the browser to experiment with different physics and layout options, using the generated JSON options structure that is spit out from the front end to serve as input to this method as a string. :param new_options: The JSON like string of the options that will override. :type new_options: str   {N)replacefindjsonloads)r new_optionsoptions first_brackets rsetz Options.sets^%%dB//77R@@ S)) -..)**W%%rc@t|dddS)Nc|jSrr;)os rz!Options.to_json..sAJrT)default sort_keysindent)rxdumpsr s rto_jsonzOptions.to_jsons+zz ..1&& &rr) r(r)r*r+rr>rr}rr,rrrgrgsn"""#######,&&&&&rrgN)ror2rr4rBrIrgr,rrrsE E E E E &E E E P#####&###"########$>)>)>)>)>)V>)>)>)D7&7&7&7&7&f7&7&7&7&7&r